From fe5eb507ca693e4db9ca1317b522765a513fea8c Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 15 Oct 2024 12:39:38 -0500 Subject: Support params-only searches (#5767) --- src/view/screens/Search/Search.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/view/screens/Search/Search.tsx b/src/view/screens/Search/Search.tsx index 5b4faacec..652d4ec38 100644 --- a/src/view/screens/Search/Search.tsx +++ b/src/view/screens/Search/Search.tsx @@ -504,7 +504,8 @@ let SearchScreenInner = ({ ) const sections = React.useMemo(() => { - if (!query) return [] + if (!queryWithParams) return [] + const noParams = queryWithParams === query return [ { title: _(msg`Top`), @@ -526,22 +527,25 @@ let SearchScreenInner = ({ /> ), }, - { + noParams && { title: _(msg`People`), component: ( ), }, - { + noParams && { title: _(msg`Feeds`), component: ( ), }, - ] + ].filter(Boolean) as { + title: string + component: React.ReactNode + }[] }, [_, query, queryWithParams, activeTab]) - return query ? ( + return queryWithParams ? ( ( @@ -640,7 +644,7 @@ export function SearchScreen( const {params, query, queryWithParams} = useQueryManager({ initialQuery: queryParam, }) - const showFilters = Boolean(query && !showAutocomplete) + const showFilters = Boolean(queryWithParams && !showAutocomplete) /* * Arbitrary sizing, so guess and check, used for sticky header alignment and * sizing. -- cgit 1.4.1