fix(wizard): off-by-one causing step 7/6 display and broken completion
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- 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)
This commit is contained in:
@@ -192,7 +192,12 @@ export function AgentOnboardingWizard({ isOpen, onClose, onSuccess }: AgentOnboa
|
|||||||
// Navigate to next step
|
// Navigate to next step
|
||||||
const nextStep = () => {
|
const nextStep = () => {
|
||||||
if (validateStep(currentStep)) {
|
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 {
|
} else {
|
||||||
setSubmitStatus('error');
|
setSubmitStatus('error');
|
||||||
}
|
}
|
||||||
} catch {
|
} catch (err) {
|
||||||
|
log.error('Agent creation failed:', err);
|
||||||
setSubmitStatus('error');
|
setSubmitStatus('error');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -723,7 +729,7 @@ export function AgentOnboardingWizard({ isOpen, onClose, onSuccess }: AgentOnboa
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{currentStep < steps.length ? (
|
{currentStep < steps.length - 1 ? (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={nextStep}
|
onClick={nextStep}
|
||||||
|
|||||||
Reference in New Issue
Block a user