fix(desktop): clean stale draft stores (#34651)

This commit is contained in:
Brendan Allan
2026-07-01 09:03:27 +00:00
committed by GitHub
parent 6f2ff35656
commit 2f4d36d64e
5 changed files with 216 additions and 1 deletions
+5
View File
@@ -2,6 +2,7 @@ import Store from "electron-store"
import electron from "electron"
import { SETTINGS_STORE } from "./store-keys"
import { deleteStoreFileIfEmpty } from "./store-cleanup"
const cache = new Map<string, Store>()
@@ -21,3 +22,7 @@ export function getStore(name = SETTINGS_STORE) {
cache.set(name, next)
return next
}
export async function removeStoreFileIfEmpty(name: string) {
if (await deleteStoreFileIfEmpty(electron.app.getPath("userData"), name)) cache.delete(name)
}