diff --git a/packages/client-storage/src/index.ts b/packages/client-storage/src/index.ts index 3723027f..1adc5bc7 100644 --- a/packages/client-storage/src/index.ts +++ b/packages/client-storage/src/index.ts @@ -13,6 +13,8 @@ export function set( const strResolved = options.compress ? lz.compress(str) : str if (options.schema === 'indexeddb') { + localStorage.removeItem(key) + indexeddb .set(key, strResolved) .then((value) => { @@ -25,7 +27,10 @@ export function set( return } + indexeddb.del(key).catch(() => {}) localStorage.setItem(key, strResolved) + + res(key) }) }