From 7268e3f55c6b033b682bd172f1a4db0b4756e5bd Mon Sep 17 00:00:00 2001 From: "buf0-bot[bot]" <252831055+buf0-bot[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 15:21:40 -0700 Subject: [PATCH] fix: address pr-bug-scan findings from #1442 (#1468) Fixed two TaskPage resume-state regressions: the debounced GitHub search now persists even when activeTaskPreset is non-null (drops the guard, persists current preset+query), and re-added the mid-sess Co-authored-by: orca-bug-scan-bot --- src/renderer/src/components/TaskPage.tsx | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/components/TaskPage.tsx b/src/renderer/src/components/TaskPage.tsx index 67d653070..04bd63483 100644 --- a/src/renderer/src/components/TaskPage.tsx +++ b/src/renderer/src/components/TaskPage.tsx @@ -785,6 +785,17 @@ export default function TaskPage(): React.JSX.Element { } }, [pageData.taskSource]) + // Why: settings.defaultTaskSource can change while Tasks is open (Settings + // panel is reachable without unmounting Tasks). The one-shot resume effect + // only seeds taskSource on first mount, so without this sync a mid-session + // change to the default would not propagate when no explicit page-level + // taskSource was passed. + useEffect(() => { + if (!pageData.taskSource && settings?.defaultTaskSource) { + setTaskSource(settings.defaultTaskSource) + } + }, [settings?.defaultTaskSource, pageData.taskSource]) + // Why: Project mode is a sub-tab within the GitHub source. Visible whenever // the user is on the GitHub task source — actual entry into Project mode is // gated on a non-null `activeProject` once they pick one. @@ -1246,11 +1257,14 @@ export default function TaskPage(): React.JSX.Element { githubSearchPersistReadyRef.current = true return } - if (activeTaskPreset !== null) { - return - } + // Why: persist the debounced applied query regardless of the active + // preset. The preset-click handler writes the canonical query for that + // preset, so persisting again here is at worst idempotent. When the + // user types into the search box `handleTaskSearchChange` clears the + // preset, but persisting unconditionally also covers paths that change + // appliedTaskSearch without going through that handler. setTaskResumeState({ - githubItemsPreset: null, + githubItemsPreset: activeTaskPreset, githubItemsQuery: appliedTaskSearch.trim() }) }, [activeTaskPreset, appliedTaskSearch, setTaskResumeState, taskResumeApplied])