Fix local/session storage parsing/stringifying values
The old logic stringifyed all values, including strings, which caused problems with reading external stored values (e.g., mui-mode) via the "useStorage" hook.
This commit is contained in:
@@ -30,10 +30,11 @@
|
||||
<script type="module" src="./src/index.tsx"></script>
|
||||
<script>
|
||||
const backgroundColor = (() => {
|
||||
const storageValue = window.localStorage.getItem("theme_background")
|
||||
try {
|
||||
return JSON.parse(window.localStorage.getItem("theme_background"))
|
||||
return JSON.parse(storageValue)
|
||||
} catch (e) {
|
||||
return null
|
||||
return storageValue
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user