fix: branching forms with visibilityCriteria render the hidden next step#477
Merged
christianmat merged 1 commit intomainfrom Apr 30, 2026
Merged
Conversation
internalComplete computed the next step optimistically from pre-request visibility, then fired STARTED_STEP for it after the COMPLETED_STEP/SKIPPED_STEP response refreshed state. In branching forms whose visibilityCriteria depends on the just-submitted form data, the optimistic next step could be hidden by the server, and the STARTED_STEP would clobber currentStepId back to the now-hidden step — leaving the user stuck on a step that should have been skipped. Now derive the next-step event from this.getCurrentStep() after the refresh so we notify the server about the actual current step. The non-branching behavior added in 2723c81 is preserved (covered by a new regression test). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
visibilityCriteriadepending on the just-submitted step's form data would still render the now-hidden next step instead of skipping past it. Reported by a customer onflow_dVcRW58i(docs example for branching forms).internalComplete(packages/js-api/src/core/flow.ts), after the COMPLETED_STEP/SKIPPED_STEP response refreshed state, the client fired a follow-upSTARTED_STEPfor the optimistic next step (chosen from pre-request visibility). When the server hid that step viavisibilityCriteriaafter seeing the form data, the spuriousSTARTED_STEPflippedcurrentStepIdback to the now-hidden step. Verified by replaying the API sequence against prod with the customer's flow.this.getCurrentStep()rather than the pre-requestnextStepForStartEvent. The non-branching behavior added in 2723c81 is preserved (the new regression test guards it).@frigade/jsand@frigade/reactas patches so customers pick up the fix on a normalyarn upgrade @frigade/react.Test plan
packages/js-api/test/flow-branching-visibility.test.tsreproduces the bug, then passes after the fix.STARTED_STEPfor the next step (preserves 2723c81).yarn testinpackages/js-api: 28 passed, 0 failed (existingflow-flickerand integration tests unaffected).🤖 Generated with Claude Code