atomWithStorage "storage" listeners don't work + string values handling can cause issues #2615
Unanswered
leo-diehl
asked this question in
Bug report
Replies: 1 comment
|
I'm not exactly sure what you suggest. Can you spot the unexpected behavior? Are you suggesting either a) fix an issue, or b) fix the docs? |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
From the docs for the
storagewindow event:I wonder if developers were aware about this limitation when the JSONStorage was implemented: https://github.com/pmndrs/jotai/blob/main/src/vanilla/utils/atomWithStorage.ts#L185
This creates a misleading notion that you can set localStorage values outside jotai and the values will be reflected on your atoms.
Sandbox issue reproduction link
If this is known, I think we should at least add something in the docs to make it clear that all modification to the storage key must be done through jotai, otherwise the atom might misbehave.
All reactions