Support params-only searches (#5767)
(cherry picked from commit fe5eb507ca)
This commit is contained in:
@@ -503,7 +503,8 @@ let SearchScreenInner = ({
|
|||||||
)
|
)
|
||||||
|
|
||||||
const sections = React.useMemo(() => {
|
const sections = React.useMemo(() => {
|
||||||
if (!query) return []
|
if (!queryWithParams) return []
|
||||||
|
const noParams = queryWithParams === query
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
title: _(msg`Top`),
|
title: _(msg`Top`),
|
||||||
@@ -525,22 +526,25 @@ let SearchScreenInner = ({
|
|||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
noParams && {
|
||||||
title: _(msg`People`),
|
title: _(msg`People`),
|
||||||
component: (
|
component: (
|
||||||
<SearchScreenUserResults query={query} active={activeTab === 2} />
|
<SearchScreenUserResults query={query} active={activeTab === 2} />
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
noParams && {
|
||||||
title: _(msg`Feeds`),
|
title: _(msg`Feeds`),
|
||||||
component: (
|
component: (
|
||||||
<SearchScreenFeedsResults query={query} active={activeTab === 3} />
|
<SearchScreenFeedsResults query={query} active={activeTab === 3} />
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
]
|
].filter(Boolean) as {
|
||||||
|
title: string
|
||||||
|
component: React.ReactNode
|
||||||
|
}[]
|
||||||
}, [_, query, queryWithParams, activeTab])
|
}, [_, query, queryWithParams, activeTab])
|
||||||
|
|
||||||
return query ? (
|
return queryWithParams ? (
|
||||||
<Pager
|
<Pager
|
||||||
onPageSelected={onPageSelected}
|
onPageSelected={onPageSelected}
|
||||||
renderTabBar={props => (
|
renderTabBar={props => (
|
||||||
@@ -639,7 +643,7 @@ export function SearchScreen(
|
|||||||
const {params, query, queryWithParams} = useQueryManager({
|
const {params, query, queryWithParams} = useQueryManager({
|
||||||
initialQuery: queryParam,
|
initialQuery: queryParam,
|
||||||
})
|
})
|
||||||
const showFilters = Boolean(query && !showAutocomplete)
|
const showFilters = Boolean(queryWithParams && !showAutocomplete)
|
||||||
/*
|
/*
|
||||||
* Arbitrary sizing, so guess and check, used for sticky header alignment and
|
* Arbitrary sizing, so guess and check, used for sticky header alignment and
|
||||||
* sizing.
|
* sizing.
|
||||||
|
|||||||
Reference in New Issue
Block a user