[CMDCT-3032] Fix text fields not saving in nested choices if not last field in choicelist #11514
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
Important Note!
While reviewing this, you'll see my videos with the Before and After. The before captures a state where the user is tabbing off the checkbox's child to another choice, and then moving to a different page before coming back. THIS IS NOT FIXED. I've tried friends. I really have. We need state management something fierce. That being said, what is fixed are all of the scenarios in the after column. Which are a heck of a lot better then before. Go ahead and repeat those on main and you'll see the difference. Nested fields were getting cleared for no reason when still on the same page. This solves that. For going to a different page though and coming back? I can't do it with out some real edge case spagehetti that would require so many tests. I tried writing those tests too. You don't want those tests and all those branches. It introduces too much complexity and variables. Revisit this when we have more time and zustand can be properly enacted.
If a user was to tab to a different checked answer when filling out a child choice, it would clear that child choice. This fixes it so other fields that were filled out won't be changed!
This really just removes code that didn't need to be there any longer and fixes the value being sent to what the form has it stored as.
Before
281254377-86266114-a6bf-400e-aec8-8eeb56927dad.mov
After
Screen.Recording.2023-11-14.at.11.06.35.AM.mov
Screen.Recording.2023-11-07.at.11.28.56.PM.mov
Screen.Recording.2023-11-07.at.11.57.18.PM.mov
Screen.Recording.2023-11-08.at.12.02.42.AM.mov
Related ticket(s)
CMDCT-3032
How to test
Create a Report
Navigate to C1.III.1 Uses of encounter data
Check Other Specify, fill out the text box
tab off to the next choice
click anywhere that is not in the choicelist (like to another page)
Come back and see its still there!
Go into B.X.7a Changes in Provider circumstances: Monitoring Plans
Play around and make sure its sending and filling out correctly as you clear and check things
Open MLR
Checkout the overlay section too!
Author checklist