fix: welcome dialog Save overwriting user's agent pick (#4)

The Save button fired both onSave and onClose. onClose's closed-over
`config` still held the bootstrap default (agentId: 'claude'), so it
re-ran setConfig with the stale value right after onSave wrote the
user's choice — leaving the user with Claude Code even when they had
clicked Codex on first run.

Split the responsibilities: Save now owns close (handleConfigSave
calls setSettingsOpen(false)); onClose stays scoped to dismiss flows
(Skip / backdrop) where the stale-config write is harmless.
This commit is contained in:
lakatos
2026-04-28 20:41:27 +08:00
committed by GitHub
parent bc2198103a
commit d1c3230642
2 changed files with 2 additions and 4 deletions
+1
View File
@@ -116,6 +116,7 @@ export function App() {
const withOnboarding: AppConfig = { ...next, onboardingCompleted: true };
saveConfig(withOnboarding);
setConfig(withOnboarding);
setSettingsOpen(false);
}, []);
const handleModeChange = useCallback(