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.
Description
Well this was a fun one. 2 weeks ago we inadvertently introduced a bug to the codebase that broke nested field validation. Nested field validation depends on some code in
schemas.ts
that checks if the parent option is checked, and if so, creates validation schema for the nested field. This code depended on the field value matching an expected passed value that we set inmcpar.json
. When we changed ChoiceList components (radio & checkbox) to store data in a{name: "", value: ""}
object, it broke that method because the value of a given field was no longer a string, but an object. The fix for this was technically pretty easy -- just change that method to look deeper. But because it was now looking in an array of objects, a bit of tweaking was needed.As I was fixing it, I realized that we actually don't even need to rely on the
visibleOptionValue
(e.g. "Other, specify") but could instead rely on something else: theparentOptionId
(e.g. "option5"). A couple tweaks to a couple other methods later... where we used to have to specify the option value separately inmcpar.json
like this...... we can now omit the
visibleOptionValue
(as shown below), which is nowparentOptionId
and is programmatically set behind the scenes, makingmcpar.json
management just a bit easier.Resolves: https://qmacbis.atlassian.net/browse/MDCT-2019
Bug introduced in: #3959
How to test
Changed Dependencies
n/a
Code author checklist
I have added analytics, if necessaryI have updated the documentation, if necessaryReviewer checklist (two different people)