preactjs / signals

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

@preact/signals-react not updating dom while using "variable.value" but does when using "variable" #469

Closed KillerMax4299 closed 9 months ago

KillerMax4299 commented 9 months ago

This doesn't update the count value in the button

image

But this does

image

But both should work right. Later was just an optimization (optional)

I found this issue in @preact/signals-react v2.0.0 but while in v1.3.8 everything works fine. So for the time being I'm just using the older version.

andrewiggins commented 9 months ago

Hey @KillerMax4299 :wave: v2 is a new major release of signals-react and as such has some breaking changes. Check the Changelog for details on the breaking change.

Have you added import "@preact/signals-react/auto"; to the root of your application? That's the fastest way to get the same behavior as v1.3.8.

Just realizing I updated the Readme with the new instructions but didn't but a larger notice about the v2 changes. Lemme do that.

hta218 commented 9 months ago

Hey @andrewiggins, added import "@preact/signals-react/auto" does work. Thanks for mentioning that.

The v2.0.0 changelog says: "Check out the new Readme for the newly supported ways of using signals in React". But where is the new ReadMe? image

XantreDev commented 9 months ago

https://github.com/preactjs/signals/tree/main/packages/react

noopurphalak commented 9 months ago

@XantreGodlike No useSignals hook is exported in the @preact/signals-react in version 2.0.0

Screenshot 2023-12-27 at 5 00 13 PM
XantreDev commented 9 months ago

@XantreGodlike No useSignals hook is exported in the @preact/signals-react in version 2.0.0

Screenshot 2023-12-27 at 5 00 13 PM

It've been never exported from the main entry

noopurphalak commented 9 months ago

@XantreGodlike No useSignals hook is exported in the @preact/signals-react in version 2.0.0

Screenshot 2023-12-27 at 5 00 13 PM

I've never been exported from the main entry

Well, the documentation asks to import useSignals from @preact/signals-react and when I try to do that, it gives me an error. Refer the screenshot below for the documentation where it is mentioned:

Screenshot 2023-12-28 at 12 29 14 PM
XantreDev commented 9 months ago

@JoviDeCroock @noopurphalak

472

noopurphalak commented 9 months ago

@XantreGodlike Okay, got it...

besabellacyrus commented 6 months ago

Hey @KillerMax4299 👋 v2 is a new major release of signals-react and as such has some breaking changes. Check the Changelog for details on the breaking change.

Have you added import "@preact/signals-react/auto"; to the root of your application? That's the fastest way to get the same behavior as v1.3.8.

Just realizing I updated the Readme with the new instructions but didn't but a larger notice about the v2 changes. Lemme do that.

adding this one inside App.js works too. Thanks!