diff --git a/src/view/screens/Search/Search.tsx b/src/view/screens/Search/Search.tsx index 9cd7ee37..5a25ce75 100644 --- a/src/view/screens/Search/Search.tsx +++ b/src/view/screens/Search/Search.tsx @@ -6,6 +6,7 @@ import { RefreshControl, TextInput, Pressable, + Platform, } from 'react-native' import {FlatList, ScrollView, CenteredView} from '#/view/com/util/Views' import {AppBskyActorDefs, AppBskyFeedDefs, moderateProfile} from '@atproto/api' @@ -284,10 +285,17 @@ function SearchScreenUserResults({query}: {query: string}) { React.useEffect(() => { async function getResults() { - const searchResults = await search({query, limit: 30}) + try { + const searchResults = await search({query, limit: 30}) - if (searchResults) { - setResults(results) + if (searchResults) { + setResults(searchResults) + } + } catch (e: any) { + logger.error(`SearchScreenUserResults: failed to get results`, { + error: e.toString(), + }) + } finally { setIsFetched(true) } } @@ -298,7 +306,7 @@ function SearchScreenUserResults({query}: {query: string}) { setResults([]) setIsFetched(false) } - }, [query, search, results]) + }, [query, search, setResults]) return isFetched ? ( <> @@ -327,6 +335,8 @@ export function SearchScreenInner({query}: {query?: string}) { const pal = usePalette('default') const setMinimalShellMode = useSetMinimalShellMode() const setDrawerSwipeDisabled = useSetDrawerSwipeDisabled() + const {hasSession} = useSession() + const {isDesktop} = useWebMediaQueries() const onPageSelected = React.useCallback( (index: number) => { @@ -353,7 +363,7 @@ export function SearchScreenInner({query}: {query?: string}) { - ) : ( + ) : hasSession ? ( Suggested Follows + + ) : ( + + + {isDesktop && ( + + Search + + )} + + + Search for posts and users. + + + ) }