fix(app): use a deletable cursor for draft blob cleanup (#44594)

Co-authored-by: Brendan Allan <git@brendonovich.dev>
This commit is contained in:
Michael Hart 2026-08-24 14:53:39 +10:00 committed by GitHub
parent 299e314a28
commit 3eb07e38ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -114,11 +114,12 @@ export function createBrowserDraftStore(): DraftStore {
if (item?.blob && typeof item.blob.id === "string") used.add(item.blob.id)
return item
})
const blobs = transaction.objectStore("blobs").openKeyCursor()
const store = transaction.objectStore("blobs")
const blobs = store.openKeyCursor()
blobs.addEventListener("success", () => {
const cursor = blobs.result
if (!cursor) return
if (!used.has(String(cursor.key))) cursor.delete()
if (!used.has(String(cursor.key))) store.delete(cursor.key)
cursor.continue()
})
})