diff --git a/index.ts b/index.ts index 7f81a0f..683b16f 100644 --- a/index.ts +++ b/index.ts @@ -43,8 +43,6 @@ export function persisted(key: string, initialValue: T, options?: Options) if (json) { set(serializer.parse(json)) - } else { - updateStorage(key, initialValue) } if (browser) { diff --git a/test/localStorageStore.test.ts b/test/localStorageStore.test.ts index d04d400..c6f6e7d 100644 --- a/test/localStorageStore.test.ts +++ b/test/localStorageStore.test.ts @@ -23,7 +23,7 @@ describe('persisted()', () => { const value = get(store) expect(value).toEqual(123) - expect(localStorage.myKey).toEqual('123') + expect(localStorage.myKey).toBeUndefined() }) test('uses existing value if data already in local storage', () => {