From 56f6681492c9053e43cc8f97e4c1025fe7cd168f Mon Sep 17 00:00:00 2001 From: ztimson Date: Sun, 29 Jun 2025 22:29:16 -0400 Subject: [PATCH] Restoring cache from DB gets complete status --- package.json | 2 +- src/cache.ts | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8892cb3..b18944d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/utils", - "version": "0.25.19", + "version": "0.25.20", "description": "Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/cache.ts b/src/cache.ts index 9cc26aa..5d78821 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -34,12 +34,7 @@ export class Cache { if(options.storageKey && !options.storage && typeof(Storage) !== 'undefined') options.storage = localStorage; if(options.storage) { if(options.storage instanceof Table) { - (async () => (await options.storage?.getAll()).forEach((v: any) => { - if(v) { - try { this.add(v) } - catch { } - } - }))() + (async () => this.addAll(await options.storage?.getAll()))() } else if(options.storageKey) { const stored = options.storage?.getItem(options.storageKey); if(stored != null) try { Object.assign(this.store, JSON.parse(stored)); } catch { }