From 693e430047d84c5e399983b5a345bc3ca9b8c32d Mon Sep 17 00:00:00 2001 From: ColinBuyck <53269332+ColinBuyck@users.noreply.github.com> Date: Fri, 3 Jan 2025 15:53:17 -0800 Subject: [PATCH] fix: set optOut watch default value (#4512) (#824) --- sites/partners/src/components/settings/PreferenceDrawer.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sites/partners/src/components/settings/PreferenceDrawer.tsx b/sites/partners/src/components/settings/PreferenceDrawer.tsx index 7390d1477b..fd7fb6b589 100644 --- a/sites/partners/src/components/settings/PreferenceDrawer.tsx +++ b/sites/partners/src/components/settings/PreferenceDrawer.tsx @@ -92,7 +92,11 @@ const PreferenceDrawer = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [questionData]) - const optOutQuestion = watch("canYouOptOutQuestion") + const optOutQuestion = watch( + "canYouOptOutQuestion", + // set watch default value to mirror canYouOptOutQuestion default on load + questionData === null || questionData?.optOutText !== null ? YesNoEnum.yes : undefined + ) const isAdditionalDetailsEnabled = profile?.jurisdictions?.some( (jurisdiction) => jurisdiction.enableGeocodingPreferences