Zustand w/ persist + immer + superjson, not serializing/deserializing as intended
Unanswered
British Shorthair posted this in #help-forum
British ShorthairOP
I've been following the docs for my solution, and given the store is relatively simple, I am encountering weird issues. Here is the full snippet of the store: https://pastecord.com/lawolexuju.typescript.
Randomly, the saved gets serialized as an array, but majority of the time it gets serialized as a plain object which results in saved.set is not a function.
Aside from this, from my understanding, this should rehydrate on multi-tenant switches? On logout I clear tenantId and projectId, but saved should persist and upon a new tenant, it should have the previous values.
Randomly, the saved gets serialized as an array, but majority of the time it gets serialized as a plain object which results in saved.set is not a function.
Aside from this, from my understanding, this should rehydrate on multi-tenant switches? On logout I clear tenantId and projectId, but saved should persist and upon a new tenant, it should have the previous values.
4 Replies
Short-tailed Albatross
hey
hoe did you handle clearing the state/ updating states on new pages,
in my case i am using zustand when the entityPage Pnloads and that might be tricky if there are many entities to be opened,
so was wondering how to clear upon change
so was wondering how to clear upon change
any advice will be amazing, thank you