preactjs / signals

Manage state with style in every framework
https://preactjs.com/blog/introducing-signals/
MIT License
3.71k stars 91 forks source link

signals@1.2.1 not compatible with 10.11.3 #410

Closed BlowaterNostr closed 1 year ago

BlowaterNostr commented 1 year ago

I was using @preact/signals@1.2.1 and found this weird bug yesterday and spent hours on it.

The bug was that signal didn't trigger re-render and no errors or logs what so ever.

Today I find that signals@1.21 is using preact@10.17.1 while my project uses preact@10.11.3.

Updating preact solved the problem.

But this is such a horrible experience for developers. The software should find incompatibility issues and report automatically either at compile time or runtime instead of just silently error out!

rschristian commented 1 year ago

Today I find that signals@1.21 is using preact@10.17.1 while my project uses preact@10.11.3.

@preact/signals lists preact as a peer dependency, not a direct dependency, so modern package managers shouldn't have any issue with this. If you're using CDNs, then yes, this is unfortunately something you need to be aware of; it's impossible for them to know your specific setup. esm.sh will allow you to specify external dependencies though: docs

(p)react needs to be used as a singleton, loading multiple copies at once will never play nice.

BlowaterNostr commented 1 year ago

(p)react needs to be used as a singleton

I figured it out. Thank you. @rschristian