fix: persist completed item visibility
ci / gitleaks (push) Successful in 18s
ci / docker (push) Successful in 3m49s

This commit is contained in:
2026-09-08 11:24:39 +08:00
parent 356fbfa942
commit 798725ad29
5 changed files with 47 additions and 8 deletions
+15
View File
@@ -1,3 +1,18 @@
type BooleanStorage = Pick<Storage, 'getItem' | 'setItem'>
export function readStoredBoolean(storage: BooleanStorage, key: string, fallback: boolean) {
try {
const value = storage.getItem(key)
if (value === 'true') return true
if (value === 'false') return false
} catch { /* storage may be unavailable */ }
return fallback
}
export function writeStoredBoolean(storage: BooleanStorage, key: string, value: boolean) {
try { storage.setItem(key, String(value)) } catch { /* storage may be unavailable */ }
}
export function dateKey(date: Date) {
const y = date.getFullYear()
const m = `${date.getMonth() + 1}`.padStart(2, '0')