Skip to content

Commit 943b4e6

Browse files
committed
🤖 fix: avoid overwriting task settings on load error
Skip debounced auto-save when the initial config fetch fails, so default Task settings never clobber the user's stored config. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `codex cli` • Model: `gpt-5.2` • Thinking: `xhigh`_ <!-- mux-attribution: model=gpt-5.2 thinking=xhigh --> Change-Id: I472af8699b1d377254720929926d7514629903b9
1 parent 8e8b6c5 commit 943b4e6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/browser/components/Settings/sections/TasksSection.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export function TasksSection() {
1212
const { api } = useAPI();
1313
const [settings, setSettings] = useState<TaskSettings>(DEFAULT_TASK_SETTINGS);
1414
const [loaded, setLoaded] = useState(false);
15+
const [loadFailed, setLoadFailed] = useState(false);
1516
const [saveError, setSaveError] = useState<string | null>(null);
1617
const saveTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
1718
const savingRef = useRef(false);
@@ -20,23 +21,27 @@ export function TasksSection() {
2021
if (!api) return;
2122

2223
setLoaded(false);
24+
setLoadFailed(false);
2325
setSaveError(null);
2426

2527
void api.config
2628
.getConfig()
2729
.then((cfg) => {
2830
setSettings(normalizeTaskSettings(cfg.taskSettings));
31+
setLoadFailed(false);
2932
setLoaded(true);
3033
})
3134
.catch((error: unknown) => {
3235
setSaveError(error instanceof Error ? error.message : String(error));
36+
setLoadFailed(true);
3337
setLoaded(true);
3438
});
3539
}, [api]);
3640

3741
useEffect(() => {
3842
if (!api) return;
3943
if (!loaded) return;
44+
if (loadFailed) return;
4045
if (savingRef.current) return;
4146

4247
if (saveTimerRef.current) {
@@ -62,7 +67,7 @@ export function TasksSection() {
6267
saveTimerRef.current = null;
6368
}
6469
};
65-
}, [api, loaded, settings]);
70+
}, [api, loaded, loadFailed, settings]);
6671

6772
const setMaxParallelAgentTasks = (rawValue: string) => {
6873
const parsed = Number(rawValue);

0 commit comments

Comments
 (0)