Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@preact/signals-react v2.0.0 integration #58

Closed
savanesoff opened this issue Dec 21, 2023 · 7 comments · Fixed by #59
Closed

@preact/signals-react v2.0.0 integration #58

savanesoff opened this issue Dec 21, 2023 · 7 comments · Fixed by #59

Comments

@savanesoff
Copy link

Preact was just upgraded fixing a bunch of issues we were having, upgrading @preact/signals-react seems to break deepsignal proxy observers and mutations on proxy don't trigger react render.

I don't have specific logs, there aren't any to show, it is simply not working with the latest upgrade, understandably.

Do you have plans to upgrade to the latest @preact/signals-react usage? If so, let us know what the timeframe might be.

Thanks

@michalczaplinski
Copy link
Collaborator

For reference, this is the 2.0.0. changelog: https://github.com/preactjs/signals/blob/main/packages/react/CHANGELOG.md#200

For some consumers and apps though, the current mechanism does work. If you'd like to continue using this mechanism, simply add import "@preact/signals/auto"; to the root of your app where you call ReactDOM.render. For our newly supported ways of using signals in React, check out the new Readme for @preact/signals-react.

Have you tried adding the import "@preact/signals/auto"; to the root of your app?

@savanesoff
Copy link
Author

Adding import "@preact/signals/auto"; does solve the issue, thanks. Something I've missed in the release notes. 😄

@parth391
Copy link

parth391 commented Jan 4, 2024

Adding import "@preact/signals/auto"; don't work for me.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: deepsignal@1.3.6
npm ERR! Found: @preact/signals-react@2.0.0
npm ERR! node_modules/@preact/signals-react
npm ERR!   @preact/signals-react@"^2.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @preact/signals-react@"^1.3.3" from deepsignal@1.3.6
npm ERR! node_modules/deepsignal
npm ERR!   deepsignal@"*" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @preact/signals-react@1.3.8
npm ERR! node_modules/@preact/signals-react
npm ERR!   peerOptional @preact/signals-react@"^1.3.3" from deepsignal@1.3.6
npm ERR!   node_modules/deepsignal
npm ERR!     deepsignal@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

@michalczaplinski
Copy link
Collaborator

It looks like you have both @preact/signals-react@1.3.8 and @preact/signals-react@2.0.0 installed. Try removing the lockfile and/or rm -rf node_modules and reinstalling. You'll probably still get a warning about version mismatch because deepsignal has ^1.3.3 specified as the peer dependency version.

@luisherranz
Copy link
Owner

I've opened a PR to add the v2 to the peer dependencies:

@luisherranz luisherranz linked a pull request Jan 11, 2024 that will close this issue
@luisherranz
Copy link
Owner

I've also updated useDeepSignal which now uses useSignals internally, and therefore works without any other integration.

@luisherranz
Copy link
Owner

Released as part of deepsignal@1.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants