Skip to content

Signals never unwatched when using hooks and suspenses #768

@CharlieCrisp

Description

@CharlieCrisp
  • Check if updating to the latest version resolves the issue

Environment

  • I am using @preact/signals-core
  • I am using @preact/signals
  • I am using @preact/signals-react

Describe the bug
When using signals in a React project alongside suspenses, signals are never unwatched.

Rather than a wordy description, I've written some unit tests.

To Reproduce

Add the unit tests from this gist to suspense.test.tsx

https://gist.github.com/CharlieCrisp/222d10fd147596567a73ae546ff441f1

The following fail:

  • "should clean up signals after unmount with multiple suspense boundaries"
  • "should clean up signals after unmount with multiple suspense boundaries and use of try catch"

Expected behavior
Tests should pass, signals should be unwatched when components unmount

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions