-
Notifications
You must be signed in to change notification settings - Fork 1
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
Bug: passing an object to mutableAtom is not registered to a provider. #9
Comments
Nice catch! I assume you are using Valtio v2. The jotai-valtio/src/mutableAtom.ts Line 16 in 844b219
|
Oh I'm so sorry, I did not include the versions of the packages. The example is using "jotai": "^2.8.4" and "jotai-valtio": "^0.5.0". It's not using valtio directly. I just installed valtio 1.13.2 as a peer dependency, and I can still reproduce the bug. |
Hm, okay, yeah, it may happen with Valtio v1 because it's the same reference. Do you think you can open a PR? Otherwise, I can do that. import { deepClone } from 'valtio/utils'; // only available in Valtio v2
const valueAtom = atom({ value: deepClone(initialValue) }); |
pls open the pr, I tried but I couldn't find out how to import valtio v2 :S |
No problem. Yeah, it's not very straightforward to upgrade to Valtio v2. Working on it. |
Can you try #10? #9 (comment) was wrong. It's a different line to apply deepClone. |
Nice, it works! Thanks man I had to How stable do you think is version? Tbh I just need jotai |
valtio v2-rc.0 should be pretty stable but I don't get much feedback. |
Then I'll happily use it. Thanks for your fast change! |
Let me explain in code:
I've got no idea why, but using an object inside a mutableAtom makes it skip the Provider.
The text was updated successfully, but these errors were encountered: