From 6e0c1e55a999f8857bb38f13d0daa5a7310e77fe Mon Sep 17 00:00:00 2001 From: iven Date: Wed, 8 Apr 2026 19:18:33 +0800 Subject: [PATCH] fix(wizard): off-by-one causing step 7/6 display and broken completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - nextStep() was allowing currentStep to reach steps.length (6), past the last step index (5), showing "步骤 7/6:" with empty content area - On the last step, nextStep now triggers handleSubmit() directly instead of navigating to a phantom step 6 - Footer button condition changed: "完成" shows on last step instead of after it, keeping error/success messages visible - Added error logging in catch block (was silently swallowing errors) --- desktop/src/components/AgentOnboardingWizard.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/desktop/src/components/AgentOnboardingWizard.tsx b/desktop/src/components/AgentOnboardingWizard.tsx index 1c7dfa1..c65c05c 100644 --- a/desktop/src/components/AgentOnboardingWizard.tsx +++ b/desktop/src/components/AgentOnboardingWizard.tsx @@ -192,7 +192,12 @@ export function AgentOnboardingWizard({ isOpen, onClose, onSuccess }: AgentOnboa // Navigate to next step const nextStep = () => { if (validateStep(currentStep)) { - setCurrentStep((prev) => Math.min(prev + 1, steps.length)); + // On the last step, trigger submit instead of navigating past it + if (currentStep === steps.length - 1) { + handleSubmit(); + } else { + setCurrentStep((prev) => prev + 1); + } } }; @@ -290,7 +295,8 @@ export function AgentOnboardingWizard({ isOpen, onClose, onSuccess }: AgentOnboa } else { setSubmitStatus('error'); } - } catch { + } catch (err) { + log.error('Agent creation failed:', err); setSubmitStatus('error'); } }; @@ -723,7 +729,7 @@ export function AgentOnboardingWizard({ isOpen, onClose, onSuccess }: AgentOnboa
- {currentStep < steps.length ? ( + {currentStep < steps.length - 1 ? (