Add feature gate for starter pack search (#11234)

This commit is contained in:
DS Boyce
2026-07-22 13:22:56 -07:00
committed by GitHub
parent 0bd6a99613
commit 933ba1c373
2 changed files with 25 additions and 10 deletions
+1
View File
@@ -19,6 +19,7 @@ export enum Features {
PostThreadKnownLikersEnable = 'post_thread:known_likers:enable',
PostThreadKnownLikersFetchEnable = 'post_thread:known_likers:fetch:enable',
CustomLogoJapanEnable = 'custom_logo:japan:enable',
SearchStarterPacksV2Enable = 'search_starter_packs_v2:enable',
AATest = 'aa-test',
}
+24 -10
View File
@@ -54,6 +54,7 @@ let SearchResults = ({
onPageSelected: (page: number) => void
headerHeight: number
}): React.ReactNode => {
const ax = useAnalytics()
const {t: l} = useLingui()
/*
* People/Feeds visibility keys off post-only filters: a `lang` filter applies
@@ -64,6 +65,10 @@ let SearchResults = ({
const activePage = hasPostFilters && activeTab > 1 ? 0 : activeTab
const tabShape = hasPostFilters ? 'filtered' : 'plain'
const isStarterPacksEnabled = ax.features.enabled(
ax.features.SearchStarterPacksV2Enable,
)
const sections = useMemo(() => {
if (!query && !hasFilters) return []
/*
@@ -108,20 +113,29 @@ let SearchResults = ({
<SearchScreenFeedsResults query={query} active={activePage === 3} />
),
},
noFilters && {
title: l`Starter packs`,
component: (
<SearchScreenStarterPackResults
query={query}
active={activePage === 4}
/>
),
},
noFilters &&
isStarterPacksEnabled && {
title: l`Starter packs`,
component: (
<SearchScreenStarterPackResults
query={query}
active={activePage === 4}
/>
),
},
].filter(Boolean) as {
title: string
component: React.ReactNode
}[]
}, [l, query, filters, hasFilters, hasPostFilters, activePage])
}, [
l,
query,
filters,
hasFilters,
hasPostFilters,
activePage,
isStarterPacksEnabled,
])
// There may be fewer tabs after changing the search options.
const selectedPage = activePage > sections.length - 1 ? 0 : activePage