From ada5496abe1ab0e79883b357bbec08ef8c5521bd Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Fri, 25 Sep 2026 15:43:18 -0700 Subject: [PATCH] Delete removed gift wraps from storage by batching their ids instead of throttling the whole item into bulkDelete --- src/app/storage.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/storage.ts b/src/app/storage.ts index ff620340..f2e88a83 100644 --- a/src/app/storage.ts +++ b/src/app/storage.ts @@ -4,7 +4,7 @@ import {deleteDB} from "idb" import {SecureStorage} from "@aparajita/capacitor-secure-storage" import {Capacitor, registerPlugin} from "@capacitor/core" import {Preferences} from "@capacitor/preferences" -import {WEEK, ago, noop, now, on, throttle, batch, call, makeQueue} from "@welshman/lib" +import {WEEK, ago, noop, now, on, batch, call, makeQueue} from "@welshman/lib" import type {Maybe} from "@welshman/lib" import { ALERT_ANDROID, @@ -505,7 +505,9 @@ class Storage { this.app.wrapManager.load(await table.getAll()) const addOne = batch(3000, table.bulkPut) - const removeOne = throttle(3000, table.bulkDelete) + const removeOne = batch(3000, (items: WrapItem[]) => + table.bulkDelete(items.map(item => item.id)), + ) this.app.wrapManager.on("add", addOne) this.app.wrapManager.on("remove", removeOne)