fix: pr-bug-scan findings from #1468 (#1559)

Co-authored-by: orca-bug-scan-bot <orca-bug-scan-bot@stably.ai>
This commit is contained in:
buf0-bot[bot]
2026-05-07 21:58:55 -07:00
committed by GitHub
co-authored by orca-bug-scan-bot
parent 9bc8166ad8
commit 8d9b629b26
+9 -5
View File
@@ -785,14 +785,18 @@ 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.
// Why: when settings hydrate after Tasks mounts, seed taskSource from
// defaultTaskSource — but only once. Re-running on every defaultTaskSource
// change would clobber an in-session manual source pick (e.g. the user
// clicked the Linear icon and then changed the default in Settings).
const defaultTaskSourceSeededRef = useRef(false)
useEffect(() => {
if (defaultTaskSourceSeededRef.current) {
return
}
if (!pageData.taskSource && settings?.defaultTaskSource) {
setTaskSource(settings.defaultTaskSource)
defaultTaskSourceSeededRef.current = true
}
}, [settings?.defaultTaskSource, pageData.taskSource])