fix: set optOut watch default value (#4512) #824
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.
This PR releases metrotranscom#1004
Description
This PR updates the watch function to include a default value. The issue was that we were defaulting the canYouOptOutQuestion to true on all preferences that didn't explicitly set to no but depending on the watch value to be Yes in order to show the optOutText field. As a result, the watch value was undefined on load and wouldn't set to Yes until the user directly interacted with the radio leading to the confusing experience described in ticket. This one line change handles that case.
How Can This Be Tested/Reviewed?
This can be tested by editing existing preferences and adding new ones. In both cases, if the canYouOptOutQuestion shows yes, the optOutText field should be visible
Author Checklist:
yarn generate:client
and/or created a migration when requiredReview Process: