diff options
author | Eric Bailey <git@esb.lol> | 2024-10-15 12:39:38 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-15 12:39:38 -0500 |
commit | fe5eb507ca693e4db9ca1317b522765a513fea8c (patch) | |
tree | 4dd5b9bb33d6d389ab94f8a170bffe0d316bae0b | |
parent | 53b6d16b510a08e97384b203d68ae9b0d18ce209 (diff) | |
download | voidsky-fe5eb507ca693e4db9ca1317b522765a513fea8c.tar.zst |
Support params-only searches (#5767)
-rw-r--r-- | src/view/screens/Search/Search.tsx | 16 |
1 files changed, 10 insertions, 6 deletions
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: ( <SearchScreenUserResults query={query} active={activeTab === 2} /> ), }, - { + noParams && { title: _(msg`Feeds`), component: ( <SearchScreenFeedsResults query={query} active={activeTab === 3} /> ), }, - ] + ].filter(Boolean) as { + title: string + component: React.ReactNode + }[] }, [_, query, queryWithParams, activeTab]) - return query ? ( + return queryWithParams ? ( <Pager onPageSelected={onPageSelected} renderTabBar={props => ( @@ -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. |