FIO-9934 fixed appearing extra validation messages#237
Merged
johnformio merged 1 commit intomasterfrom Apr 3, 2025
Merged
Conversation
johnformio
approved these changes
Apr 3, 2025
7 tasks
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.
Link to Jira Ticket
https://formio.atlassian.net/browse/FIO-9934
Description
The root of the problem of extra errors is the fact that the validateComponent method, and with it the shouldSkipValidation method, is not called for child components inside the EditGrid and DataGrid components.
For example, there is a form with an EditGrid (and a TextField nested in it) and a DataGrid (and a required Number field nested in it) components. By default, these components are displayed. When editing the form,
this.errorsobject includes "required" and "unsavedRowsError" errors and this is expected. Next, the user decides to hide the EditGrid and DataGrid components, therefore their value set to undefined and the validation process starts. Due to the fact that the iteration of components nested in the DataGrid and EditGrid is skipped in the eachComponentData method, the validation is also skipped for nested components, and therefore the shouldSkipValidation method is skipped for all nested components, which leads to errors remaining from thethis.errorsobject for these components. Therefore, thethis.errorsobject continues to store errors of already hidden components inside the DataGrid and EditGrid.This problem is relevant only for DataGrid and EditGrid components, since for all other components with nested fields (for example, container or layout components), all child components are iterated and the validateComponent and shouldSkipValidation methods are called for each. So the problem was fixed by updating condition for the DataGrid and EditGrid components in eachComponentData method.
Breaking Changes / Backwards Compatibility
n/a
Dependencies
n/a
How has this PR been tested?
Automated test was added, some tests were updated/ All tests pass locally
Checklist: