-
Notifications
You must be signed in to change notification settings - Fork 4
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
Atoms not working with Jotai v2.9 (new store implementation) #41
Comments
Acknowledged. This issue will be resolved with the rewrite I'm working on based off of the new jotai store api pmndrs/jotai#2652. |
Ok, this is a weird one. I confirmed this is indeed a bug, however if I add the exact same code locally to codesandbox it works? The only difference is I added tests to try to reproduce but they pass. #43 I'm so confused. https://codesandbox.io/p/sandbox/atom-with-observable-infinite-mount-bug-fix-forked-253y84 |
Well, this is embarrassing... Back in May I did a full rewrite of jotai-scope to support a whole slew of edge-cases including support derived atoms. It was a full ground-up rewrite of jotai-scope. I also added a ton of tests to support all conceivable edge-cases. This is why jotai-scope main works but jotai-scope@0.6.0 does not. I'll deploy now, and this will solve this issue. |
v0.7.0 is released and is working. 🥳 |
Yeah, thanks a lot 🙏 |
Jotai Scope doesn't work with Jotai v2.9 (which introduced the new store implementation).
A non-scoped atom used inside a Jotai Scope Provider receives the default value, not the latest value.
Reproduction
Repro: https://stackblitz.com/edit/vitejs-vite-8ilg8j?file=src%2FApp.tsx&terminal=dev
The first component is rendered inside a scope provider, the other two components are rendered outside. All of them use the same non-scoped atom.
If you enter a value into the first field, all three inputs should have the same value and display the same value. But only the 2nd + 3rd components render the latest value, the first component doesn't render a value.
The text was updated successfully, but these errors were encountered: