Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 904f371

Browse files
committed
Handle StorageEvent clear properly
1 parent 71b0f6f commit 904f371

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/settings/handlers/AbstractLocalStorageSettingsHandler.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ export default abstract class AbstractLocalStorageSettingsHandler extends Settin
2929

3030
// Listen for storage changes from other tabs to bust the cache
3131
window.addEventListener("storage", (e: StorageEvent) => {
32-
this.itemCache.delete(e.key);
33-
this.objectCache.delete(e.key);
32+
if (e.key === null) {
33+
this.itemCache.clear();
34+
this.objectCache.clear();
35+
} else {
36+
this.itemCache.delete(e.key);
37+
this.objectCache.delete(e.key);
38+
}
3439
});
3540
}
3641

0 commit comments

Comments
 (0)