Skip to content
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

useLocalStorage fails to set state if user browser blocks localStorage #124

Closed
patryk-smc opened this issue Mar 15, 2022 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@patryk-smc
Copy link

It would be nice if it could fallback more gracefully.

For now, I just copied useLocalStorage code and added that inside error catch:

        const newValue = value instanceof Function ? value(storedValue) : value
        setStoredValue(newValue)
@valyrie97
Copy link

do these error checks not help your case? If not, what are you using as a test case for localStorage being blocked? I'd like to reproduce the issue locally.

@juliencrn
Copy link
Owner

Hi, it should be fixed by #439

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants