Skip to content

Commit

Permalink
fix: allow flagging of settings as well as sections of settings (#18530)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Nov 9, 2023
1 parent 982f7a3 commit a9c22d3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend/src/scenes/settings/SettingsMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export const SettingsMap: SettingSection[] = [
id: 'replay-ingestion',
title: 'Ingestion controls',
component: <ReplayCostControl />,
flag: 'SESSION_RECORDING_SAMPLING',
},
],
},
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/scenes/settings/settingsLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export const settingsLogic = kea<settingsLogicType>([
},
],
settings: [
(s) => [s.selectedLevel, s.selectedSectionId, s.sections],
(selectedLevel, selectedSectionId, sections): Setting[] => {
(s) => [s.selectedLevel, s.selectedSectionId, s.sections, s.featureFlags],
(selectedLevel, selectedSectionId, sections, featureFlags): Setting[] => {
let settings: Setting[] = []

if (!selectedSectionId) {
Expand All @@ -88,7 +88,7 @@ export const settingsLogic = kea<settingsLogicType>([
settings = sections.find((x) => x.id === selectedSectionId)?.settings || []
}

return settings
return settings.filter((x) => (x.flag ? featureFlags[FEATURE_FLAGS[x.flag]] : true))
},
],
}),
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/settings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export type Setting = {
title: string
description?: JSX.Element | string
component: JSX.Element
flag?: keyof typeof FEATURE_FLAGS
}

export type SettingSection = {
Expand Down

0 comments on commit a9c22d3

Please sign in to comment.