Skip to content

Commit

Permalink
perf(useStorageAsync): setTimeout replaced with Promise
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfred-Skyblue committed Mar 29, 2023
1 parent dc32690 commit 7384070
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/useStorageAsync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function useStorageAsync<T extends(string | number | boolean | object | n
read()

if (window && listenToStorageChanges)
useEventListener(window, 'storage', e => setTimeout(() => read(e), 0))
useEventListener(window, 'storage', e => Promise.resolve().then(() => read(e)))

if (storage) {
watchWithFilter(
Expand Down

0 comments on commit 7384070

Please sign in to comment.