From 15ac0eb40b5ca97f4facfbca1b65f8e8dc5f505d Mon Sep 17 00:00:00 2001 From: Phani Raj Date: Fri, 20 Dec 2024 10:58:08 -0600 Subject: [PATCH] do not show adaptive limits UI if feature flag is disabled --- frontend/src/scenes/surveys/SurveyEdit.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/scenes/surveys/SurveyEdit.tsx b/frontend/src/scenes/surveys/SurveyEdit.tsx index b6bf810e73577..618201395ab88 100644 --- a/frontend/src/scenes/surveys/SurveyEdit.tsx +++ b/frontend/src/scenes/surveys/SurveyEdit.tsx @@ -113,7 +113,9 @@ export default function SurveyEdit(): JSX.Element { }, ] - if (featureFlags[FEATURE_FLAGS.SURVEYS_ADAPTIVE_LIMITS]) { + const adaptiveLimitFFENabled = featureFlags[FEATURE_FLAGS.SURVEYS_ADAPTIVE_LIMITS] + + if (adaptiveLimitFFENabled) { surveyLimitOptions.push({ value: 'until_adaptive_limit', label: 'Collect a certain number of surveys per day, week or month', @@ -121,15 +123,16 @@ export default function SurveyEdit(): JSX.Element { disabledReason: surveysAdaptiveLimitsDisabledReason, } as unknown as LemonRadioOption<'until_stopped' | 'until_limit' | 'until_adaptive_limit'>) } + useMemo(() => { if (surveyUsesLimit) { setDataCollectionType('until_limit') - } else if (surveyUsesAdaptiveLimit) { + } else if (surveyUsesAdaptiveLimit && adaptiveLimitFFENabled) { setDataCollectionType('until_adaptive_limit') } else { setDataCollectionType('until_stopped') } - }, [surveyUsesLimit, surveyUsesAdaptiveLimit, setDataCollectionType]) + }, [surveyUsesLimit, surveyUsesAdaptiveLimit, adaptiveLimitFFENabled, setDataCollectionType]) if (survey.iteration_count && survey.iteration_count > 0) { setSchedule('recurring')