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 <orca-bug-scan-bot@stably.ai>
This commit is contained in:
buf0-bot[bot]
2026-05-05 15:21:40 -07:00
committed by GitHub
co-authored by orca-bug-scan-bot
parent 3b0dda595d
commit 7268e3f55c
+18 -4
View File
@@ -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])