Skip to content

[OF#5994] Fix errors for hidden fields#288

Merged
sergei-maertens merged 2 commits intomainfrom
of-5994/fix-hidden-fields-with-validation-errors-prevent-next-step
Mar 9, 2026
Merged

[OF#5994] Fix errors for hidden fields#288
sergei-maertens merged 2 commits intomainfrom
of-5994/fix-hidden-fields-with-validation-errors-prevent-next-step

Conversation

@vaszig
Copy link
Contributor

@vaszig vaszig commented Mar 6, 2026

@vaszig vaszig requested a review from sergei-maertens as a code owner March 6, 2026 15:12
@vaszig vaszig marked this pull request as draft March 6, 2026 15:12
@vaszig vaszig removed the request for review from sergei-maertens March 6, 2026 15:12
@sergei-maertens sergei-maertens self-assigned this Mar 9, 2026
@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 97.87234% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.49%. Comparing base (b0df7c0) to head (d007f0d).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/registry/editgrid/index.tsx 95.12% 2 Missing ⚠️
src/components/FormioForm.tsx 95.45% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #288      +/-   ##
==========================================
+ Coverage   69.26%   69.49%   +0.22%     
==========================================
  Files         288      288              
  Lines       10823    10913      +90     
  Branches     1753     1770      +17     
==========================================
+ Hits         7497     7584      +87     
- Misses       3322     3325       +3     
  Partials        4        4              
Flag Coverage Δ
storybook 89.74% <100.00%> (+0.11%) ⬆️
vitest 54.14% <91.48%> (+0.27%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sergei-maertens sergei-maertens force-pushed the of-5994/fix-hidden-fields-with-validation-errors-prevent-next-step branch from 494557b to 3b6ac05 Compare March 9, 2026 14:20
@sergei-maertens sergei-maertens marked this pull request as ready for review March 9, 2026 14:22
@sergei-maertens
Copy link
Member

Tested with server logic too and now it's behaving as expected with this patch!

@sergei-maertens sergei-maertens force-pushed the of-5994/fix-hidden-fields-with-validation-errors-prevent-next-step branch from 3b6ac05 to 75fbeaf Compare March 9, 2026 16:24
const {updatedErrors} = processVisibility(components, values, errors, {
parentHidden: false,
initialValues: {text: ''},
initialValues: {text1: '', text2: '', toplevel: ''},
Copy link
Contributor

@viktorvanwijk viktorvanwijk Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor thing, but these initial values should also be nested, no? And I guess toplevel cannot be a string

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes!

@sergei-maertens sergei-maertens force-pushed the of-5994/fix-hidden-fields-with-validation-errors-prevent-next-step branch from 75fbeaf to 00c16fb Compare March 9, 2026 16:51
sergei-maertens and others added 2 commits March 9, 2026 17:52
…ion error clearing omission

When a field/component becomes hidden, its validation errors in the
Formik state must be cleared to not block the form submission. Formik's
isValid state looks at the presence of 'errors' in the state and is
false as soon as any error is present.

Co-authored-by: vasileios <zigras00@gmail.com>
…den fields are cleared

Similarly to the values update (from clearOnHide), ensure the error
state is updated when a component becomes hidden. We always remove
the validation errors for hidden fields, irrespective of clear on hide.
We also do not restore validation errors when the field becomes visible
again, as the validation schema will restore these, or the backend
validation errors will do so.

Co-authored-by: vasileios <zigras00@gmail.com>
@sergei-maertens sergei-maertens force-pushed the of-5994/fix-hidden-fields-with-validation-errors-prevent-next-step branch from 00c16fb to d007f0d Compare March 9, 2026 16:52
@sergei-maertens sergei-maertens merged commit 4f1a751 into main Mar 9, 2026
11 of 12 checks passed
@sergei-maertens sergei-maertens deleted the of-5994/fix-hidden-fields-with-validation-errors-prevent-next-step branch March 9, 2026 17:03
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.

Hidden fields with validation errors prevent continuing to next step

3 participants