Find existing errors in added validation group#333
Open
sarah-storm wants to merge 2 commits intomasterfrom
Open
Find existing errors in added validation group#333sarah-storm wants to merge 2 commits intomasterfrom
sarah-storm wants to merge 2 commits intomasterfrom
Conversation
mjbp
reviewed
Feb 24, 2026
| [ACTIONS.ADD_GROUP]: (state, data) => Object.assign({}, state, { | ||
| groups: Object.assign({}, state.groups, data) | ||
| groups: Object.assign({}, state.groups, data), | ||
| errors: Object.assign({}, state.errors, findErrors(data)) |
Collaborator
There was a problem hiding this comment.
Very strictly speaking findErrors could be lifted into addGroup, and the data argument passed to this reducer could be { groups, errors } to make the reducer a bit purer, but I don't think there's any practical benefit beyond functional purity! So, I'm approving it like this.
| groups: Object.assign({}, state.groups, data), | ||
| errors: Object.assign({}, state.errors, findErrors(data)) | ||
| }), | ||
| [ACTIONS.REMOVE_GROUP]: (state, groupName) => Object.assign({}, state, { |
Collaborator
There was a problem hiding this comment.
We might need to remove errors in removeGroup to clean up state at some point if we're using it for anything else, but not if you don't need it today!
mjbp
approved these changes
Feb 24, 2026
Contributor
Author
|
Updates pushed! Thanks for the review - happy to make changes and get it clean and complete just now! |
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.
Due to some new functionality around an 'add another' form type, there's a possibility that a form group could be added to the validator in a pre-existing errored state with a server error node.
The errored state is picked up if an input starts that way on page load (using the findErrors utility called by getInitialState) but it isn't also scanned for when a group is added by the API addGroup method.
I've added a call to the utility as part of the reducer - if thats the best place to do this?