Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Surveys): do not show adaptive limits UI if feature flag is disabled #27112

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions frontend/src/scenes/surveys/SurveyEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,26 @@ 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',
'data-attr': 'survey-collection-until-adaptive-limit',
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')
Expand Down
Loading