chore: bump version (#2249)

This commit is contained in:
Himself65 authored and GitHub committed 2023-05-05 23:41:51 -05:00
1 parent 1ef408c9ad
commit 496225a92e
16 files changed
+643 -633

No files matched your search

+3 -3
View File
@@ -15,16 +15,16 @@ type SetStateActionWithReset<Value> =
// similar to atomWithStorage, but will not trigger twice on init
// https://github.com/pmndrs/jotai/discussions/1737
export function atomWithSyncStorage<Value>(key: string, initialValue: Value) {
const storedValue = storage.getItem(key) as Value;
const storedValue = storage.getItem(key, initialValue) as Value;
const _value =
typeof storedValue === 'symbol'
? initialValue
: (storage.getItem(key) as Value);
: (storage.getItem(key, initialValue) as Value);
const baseAtom = atom(_value);
baseAtom.onMount = setAtom => {
if (storage.subscribe) {
return storage.subscribe(key, setAtom);
return storage.subscribe(key, setAtom, initialValue);
}
};