-
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
Scope caused atomWithObservable
to be out of sync
#36
Comments
Related: #25 There is currently no way to distinguish between a derived atom that references a scoped atom, and a derived atom that does not. jotai-scope has to copy every derived atom to intercept their getter and setter to address this. As you discovered, this copy can cause problems. PR #35 adds an api to not copy specified derived atoms. I would merge this but I think there's a better way. PR #2609 makes a change to the store api that removes the need to copy derived atoms at all. 2609 should merge in a few weeks. Once 2609 lands I'll rewrite jotai-scope to address the issue you found and #25. |
Update: Integrating with pmndrs/jotai#2609 is a lot harder than I imagined. I need to spend more time to understand how to rewrite jotai-scope following these changes. Also, it looks like an atomWithObservable refactor is in the works with pmndrs/jotai#2631, but unfortunately it looks as though the issue is still present. |
Example
The 2 counters below while using the same atom are completely different
Reproduction
Code sandbox link
The text was updated successfully, but these errors were encountered: