luisherranz / deepsignal

DeepSignal 🧶 - Preact signals, but using regular JavaScript objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@preact/signals-react v2.0.0 integration

savanesoff opened this issue · comments

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

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?

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

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.

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.

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

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

Released as part of deepsignal@1.4.0.