Conversation
Add StepValidateFn type, onStepValidate option, stepValidating state, and nextStepAsync() method. Enables server-side validation between steps without UX glitches. Includes try/finally for exception safety, stale-step guard, and smart error routing to topLevelErrors.
Pass onStepValidate into engine options, make handleNext/onNext async via nextStepAsync(), merge stepValidating into loading state for the Continue button. Add stepValidating to Vue composable return type.
Add 13 tests for nextStepAsync covering sync fallback, error blocking, concurrent call rejection, exception recovery, stale-step discard, and topLevelErrors routing. Update React multi-step tests to use waitFor for async handleNext.
Add onStepValidate section to steps guide with React/Vue examples, update validation timing docs, add async error handling section, and document StepValidateFn type and stepValidating property in API reference.
Reset stepValidating before _notify() in each exit path instead of using a finally block. Reduces re-renders from 2 to 1 per step advance.
Reset errors and topLevelErrors before processing onStepValidate return value. Prevents stale errors from previous attempts accumulating across retries.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
onStepValidatecallback: async validation that runs between steps,after sync validation passes, but before the transition. Enables server-side
checks without the visual glitch of advancing and snapping back.
nextStepAsync()method on FormEngine,stepValidatingstate property.state automatically during async validation.