localStorage issues
See original GitHub issueI am working on a desktop webapp that relies on Chakra for the UI rendering.
I am having issues using ColorModeProvider. Specifically using <DarkMode>.
It appears that on macOS (Safari WKWebView) the page is not able to access localStorage and it just crashes.
It would be nice to have a switch option to use/not use the localStorage feature provided by the use-dark-mode library and just let my application handle the user preference.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Is LocalStorage safe to use? - Snyk
When used thoughtfully, local storage can be a powerful lightweight data storage solution that isn't without problems.
Read more >Please Stop Using Local Storage - DEV Community
... issues by doing so. Let's have a heart-to-heart and talk about local storage and why you should stop using it to store...
Read more >Your browser's local storage can be misused. Here's how.
Local storage remains persistent even after closing and reopening the browser. The information stored on the local storage will remain available ...
Read more >Please Stop Using Local Storage - Randall Degges
This means anything sensitive you've got in local storage (like a user's session data) can be compromised. Now, you might be thinking “So...
Read more >Can local storage ever be considered secure? - Stack Overflow
Well, the basic premise here is: no, it is not secure yet. Basically, you can't run crypto in JavaScript: JavaScript Crypto Considered Harmful....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I just got around the issue with a solution like this:
What I did is basically defining my own
ColorModeProviderthat doesn’t use anything but acolorModeproperty. You should implement your customtoggleColorModeor setcolorModewith your rules.Color mode now works correctly with
localStoragein 1.0! https://next.chakra-ui.com/docs/color-mode