fix(desktop): clean stale draft stores (#34651)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user