fix(core): clear stale wizard step errors#289
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughThis pull request fixes a bug where wizard transitions were blocked by stale async validation errors. When field values change after async revalidation, the step-specific errors are now cleared before navigation. The fix includes regression tests for nextStep() and goToStep() scenarios. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/core/src/forms/internal/wizard.ts (1)
200-218:⚠️ Potential issue | 🟠 MajorThis broadens error clearing beyond edited-field cases; verify the intended contract.
The code clears
setFieldError(...)blockers whenevervalidateAsyncis enabled and the transition passes, even if the user never changed the field value. WhenincludeSourceErrors: false(line 289),clearValidationFieldsremoves stored step errors before running validation, and ifrunWizardStepValidationproduces no new errors, the blocker stays cleared.All existing tests pair
setFieldErrorwithsetFieldValuebefore navigation, so they don't expose this path. If the intended behavior is "only clear errors stale from old values," add a field-value-change gate. Otherwise, confirm this broader behavior is intentional and update test coverage to cover the no-edit scenario.Also applies to callers at lines 289, 342, 406, 459
All four transition entry points use the same `includeSourceErrors: !options.validateAsync` pattern.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 90919b1d-0ee9-4efd-918b-fcdf417dce82
📒 Files selected for processing (3)
CHANGELOG.mdpackages/core/src/forms/__tests__/form.wizard.test.tspackages/core/src/forms/internal/wizard.ts
Summary
nextStep()andgoToStep()transition pathsTesting
npm run buildnpm run lintnpm run typechecknode scripts/run-tests.mjs --filter "form.wizard"node scripts/run-tests.mjs --filter "useForm"Summary by CodeRabbit
Release Notes