diff --git a/src/vanilla/utils/atomWithStorage.ts b/src/vanilla/utils/atomWithStorage.ts index 74a176d743..7b044f41dc 100644 --- a/src/vanilla/utils/atomWithStorage.ts +++ b/src/vanilla/utils/atomWithStorage.ts @@ -210,9 +210,7 @@ export function atomWithStorage( } baseAtom.onMount = (setAtom) => { - if (!getOnInit) { - setAtom(storage.getItem(key, initialValue) as Value | Promise) - } + setAtom(storage.getItem(key, initialValue) as Value | Promise) let unsub: Unsubscribe | undefined if (storage.subscribe) { unsub = storage.subscribe(key, setAtom, initialValue)