diff options
author | Sebastian <sebasjm@gmail.com> | 2022-12-09 10:37:41 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-12-09 10:37:41 -0300 |
commit | 1665cf4f72b831412e5d704d02be5887be090e50 (patch) | |
tree | 129a1ab30d835e6c4cf93c05ff34c228ba77ea0a | |
parent | eb2e04aaf82828f2bb4dfa1787e7304fe8353f2b (diff) |
fix: wrong listener place
-rw-r--r-- | packages/web-util/src/hooks/useLocalStorage.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/web-util/src/hooks/useLocalStorage.ts b/packages/web-util/src/hooks/useLocalStorage.ts index 25df9dfcd..f518405b6 100644 --- a/packages/web-util/src/hooks/useLocalStorage.ts +++ b/packages/web-util/src/hooks/useLocalStorage.ts @@ -85,9 +85,9 @@ export function useNotNullLocalStorage( const listener = buildListenerForKey(key, (newValue) => { setStoredValue(newValue ?? initialValue) }) - window.localStorage.addEventListener('storage', listener) + window.addEventListener('storage', listener) return () => { - window.localStorage.removeEventListener('storage', listener) + window.removeEventListener('storage', listener) } }) |