How would I handle local storage quota reached errors using persist
?
#1938
Unanswered
phultquist
asked this question in
Q&A
Replies: 2 comments 2 replies
-
yeah, really need a solution for this too, any ideas? Also is there a way to customise what happens if JSON.parse fails? |
Beta Was this translation helpful? Give feedback.
1 reply
-
I have faced this issue too. I am using zustand/persist to write a lot of data to localStorage. The data includes a JSON string Is there any workaround for onError or retry? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
We've got a zustand setup that is roughly:
Some of our users are getting errors saving to local storage due to a quota exceeded. These errors crash our app and are handled by the error boundary. I'm wondering if there's a way I can handle these errors so they don't throw? I briefly looked in the docs and couldn't find anything.Is wrapping the
persist()
in atry/catch
sufficient?Thanks!
Specific error:
Beta Was this translation helpful? Give feedback.
All reactions