From 798725ad29802f21723cd98ef85294596f3f39bf Mon Sep 17 00:00:00 2001 From: bboysoul Date: Tue, 8 Sep 2026 11:24:39 +0800 Subject: [PATCH] fix: persist completed item visibility --- frontend/src/App.vue | 8 +++++--- frontend/src/MvpPanel.vue | 8 +++++--- frontend/src/lib/mvp-utils.test.ts | 15 ++++++++++++++- frontend/src/lib/mvp-utils.ts | 15 +++++++++++++++ frontend/src/style.test.ts | 9 ++++++++- 5 files changed, 47 insertions(+), 8 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 7ccb148..d1e5cb1 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -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() } }) diff --git a/frontend/src/MvpPanel.vue b/frontend/src/MvpPanel.vue index 13e2e21..053aa38 100644 --- a/frontend/src/MvpPanel.vue +++ b/frontend/src/MvpPanel.vue @@ -1,8 +1,8 @@