Skip to content

fix: refresh criteriaMode flag when form options are updated at runtime - #13737

Merged
bluebill1049 merged 1 commit into
react-hook-form:masterfrom
soroush5:fix/criteriamode-runtime-refresh
Sep 11, 2026
Merged

bluebill1049 merged 1 commit into
react-hook-form:masterfrom
soroush5:fix/criteriamode-runtime-refresh

Conversation

@soroush5

Copy link
Copy Markdown
Contributor

Changing the criteriaMode prop after mount had no effect on validation output.

The shouldDisplayAllAssociatedErrors flag was captured once when the form control was created, while mode and reValidateMode are already refreshed whenever options are assigned. This change refreshes the criteriaMode-derived flag in the same setter, so switching between firstError and all at runtime takes effect on the next validation.

Verified with runtime-switch tests in both directions (firstError to all and back), plus the full test suite, tsc, and eslint.

@bluebill1049
bluebill1049 merged commit 8918788 into react-hook-form:master Sep 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants