mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-24 19:53:40 +00:00
fix(app): use a deletable cursor for draft blob cleanup (#44594)
Co-authored-by: Brendan Allan <git@brendonovich.dev>
This commit is contained in:
parent
299e314a28
commit
3eb07e38ae
1 changed files with 3 additions and 2 deletions
|
|
@ -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()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue