Skip to content
Discussion options

You must be logged in to vote

How I managed to make zustand persist accept asynchronous storage.

First of all, I want to acknowledge the simplicity with which this library was created, otherwise I wouldn't have the confidence to look into its source code and try a workaround. Big up team! 🙌🏼
My hopes are that this is not just a hack, but serves as an inspiration to others or maybe even a good fix for this amazing library.

Problem

As I said earlier, my issue was that zustand's persist middleware was overwriting the storage on hydrate, because there was no "initial" way of making it to or check for a condition before overwriting the storage or wait for a trigger to start hydration, before getting the storage - in case o…

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@gabimoncha
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by gabimoncha
Comment options

You must be logged in to vote
1 reply
@LeonMueller-OneAndOnly
Comment options

Comment options

You must be logged in to vote
2 replies
@LeonMueller-OneAndOnly
Comment options

@LeonMueller-OneAndOnly
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants