From 1665cf4f72b831412e5d704d02be5887be090e50 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 9 Dec 2022 10:37:41 -0300 Subject: [PATCH] fix: wrong listener place --- packages/web-util/src/hooks/useLocalStorage.ts | 4 ++-- 1 file 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) } })