From d1c3230642c7008832c2b3c27020a5ff6e718a4c Mon Sep 17 00:00:00 2001 From: lakatos <279568067+heylakatos@users.noreply.github.com> Date: Tue, 28 Apr 2026 20:41:27 +0800 Subject: [PATCH] fix: welcome dialog Save overwriting user's agent pick (#4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/App.tsx | 1 + src/components/SettingsDialog.tsx | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 46876ed..b1afbc7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -116,6 +116,7 @@ export function App() { const withOnboarding: AppConfig = { ...next, onboardingCompleted: true }; saveConfig(withOnboarding); setConfig(withOnboarding); + setSettingsOpen(false); }, []); const handleModeChange = useCallback( diff --git a/src/components/SettingsDialog.tsx b/src/components/SettingsDialog.tsx index 68dd61c..e14a07f 100644 --- a/src/components/SettingsDialog.tsx +++ b/src/components/SettingsDialog.tsx @@ -276,10 +276,7 @@ export function SettingsDialog({ type="button" className="primary" disabled={!canSave} - onClick={() => { - onSave(cfg); - onClose(); - }} + onClick={() => onSave(cfg)} > {welcome ? t('settings.getStarted') : t('common.save')}