fix: wrong listener place

This commit is contained in:
Sebastian 2022-12-09 10:37:41 -03:00
parent eb2e04aaf8
commit 1665cf4f72
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1

View File

@ -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)
}
})