Closed alexamy closed 1 year ago
First issue was opened in https://github.com/preactjs/signals/issues/303.
Quoting the other issue:
This is neither an issue with Preact or with signals. The code is not updating because you're loading multiple copies of Preact in that sandbox which are not aware of each other. Hooks require singletons to work behind the scenes (same in React) which doesn't play well with multiple copies of the framework being present.
Resolved in https://github.com/preactjs/signals/issues/303
Describe the bug When using latest Preact version (v10.12.1), signals aren't working.
To Reproduce I'm using static html page without bundler.
signal
: https://codesandbox.io/s/preact-signal-bug-s91cfuuseSignal
: https://codesandbox.io/s/preact-usesignal-bug-0c2x6qSteps to reproduce the behavior:
Expected behavior The count incrementing by 1 after '+' button press.
Actual behavior In case of
signal
the count stays at 0 after '+' button press. In case ofuseSignal
page isn't rendered at all.Solution Downgrade to Preact v10.11.3.
signal
: https://codesandbox.io/s/preact-signal-bug-old-preact-s5teouuseSignal
: https://codesandbox.io/s/preact-usesignal-bug-old-preact-kpnfmr