You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a key is removed, evt.newValue is set to null, and thus gets filtered out in this conditional. I have confirmed through while debugging, and the second tab does receive the storage event correctly, but gets filtered out here.
This seems like a bug, because there's an invocation to the event handlers with the value null on the during the remove step, however that only applies to the current tab and is not synced to other tabs.
Did this work in previous versions? Not that I know of
The text was updated successfully, but these errors were encountered:
develohpanda
changed the title
Removal of localStorage or sessionStorage key is not synced across tabs/instances
Removal of localStorage or sessionStorage key is not synced across tabs
Apr 12, 2024
Prior Issues
None that I could find
What is the current behavior?
Remove a local storage key in one tab, observe that it does not trigger an update in another tab.
Steps to Reproduce
What is the expected behavior?
Key removals should be synchronized across tabs
Potential cause
I believe the cause is in this event handler, specifically the
evt.newValue
condition.web/src/useStorageValue/index.ts
Lines 28 to 32 in 579a445
When a key is removed,
evt.newValue
is set to null, and thus gets filtered out in this conditional. I have confirmed through while debugging, and the second tab does receive the storage event correctly, but gets filtered out here.This seems like a bug, because there's an invocation to the event handlers with the value
null
on the during theremove
step, however that only applies to the current tab and is not synced to other tabs.web/src/useStorageValue/index.ts
Line 235 in 579a445
Environment Details
@react-hookz/web
version: 23.1.0 and 24.0.4react
version: 18.2.0react-dom
version: 18.2.0typescript
version: 5.4.4The text was updated successfully, but these errors were encountered: