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
+5 -3
View File
@@ -6,7 +6,7 @@ import {
Settings, Trash2, X, Repeat2,
} from 'lucide-vue-next'
import { buildTaskRrule, defaultTaskDueAt, filterTasks, fromDateTimeLocal, groupTaskTree, moveItemWithinScope, parseTaskRrule, renderMarkdown, toDateTimeLocal, type TaskRepeatConfig } from './lib/task-utils'
import { defaultView, isTaskView, nextTotalAfterLocalTaskAdd, shouldToggleRowSwipe, writeCountdownCache } from './lib/mvp-utils'
import { defaultView, isTaskView, nextTotalAfterLocalTaskAdd, readStoredBoolean, shouldToggleRowSwipe, writeCountdownCache, writeStoredBoolean } from './lib/mvp-utils'
import { csrfHeader } from './lib/csrf'
import MvpPanel from './MvpPanel.vue'
import CountdownPanel from './CountdownPanel.vue'
@@ -43,7 +43,8 @@ const mobileDetail = ref(false)
const mobileMore = ref(false)
const moreSettingsOpen = ref(false)
const markdownPreview = ref(false)
const showCompleted = ref(true)
const SHOW_COMPLETED_STORAGE_KEY = 'dodo.show-completed'
const showCompleted = ref(readStoredBoolean(window.localStorage, SHOW_COMPLETED_STORAGE_KEY, true))
const page = ref(1)
const pageSize = 50
const totalTasks = ref(0)
@@ -242,7 +243,8 @@ watch(query, () => {
page.value = 1
searchTimer = window.setTimeout(() => loadAll(), 250)
})
watch(showCompleted, () => {
watch(showCompleted, (value) => {
writeStoredBoolean(window.localStorage, SHOW_COMPLETED_STORAGE_KEY, value)
if (isTaskView(activeView.value)) { page.value = 1; loadAll() }
})