Skip to content

Commit

Permalink
[@mantine/hooks] use-local-storage: Fix value not updated when local …
Browse files Browse the repository at this point in the history
…storage value is cleared (#3298)

* [@mantine/hooks] use-local-storage: Fix event not called when remove item

* [@mantine/hooks] use-local-storage: remove to null
  • Loading branch information
auronsan1st committed Jan 17, 2023
1 parent 9e5cefa commit 4c62aac
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/mantine-hooks/src/use-local-storage/create-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export function createStorage<T>(type: StorageType, hookName: string) {

const removeStorageValue = useCallback(() => {
window[type].removeItem(key);
window.dispatchEvent(new CustomEvent(eventName, { detail: { key, value: null } }));
}, []);

useWindowEvent('storage', (event) => {
Expand Down

0 comments on commit 4c62aac

Please sign in to comment.