Move query augmentation to lower component (#2748)
parent
fca00d20a4
commit
6ad5863573
|
@ -190,7 +190,13 @@ type SearchResultSlice =
|
|||
|
||||
function SearchScreenPostResults({query}: {query: string}) {
|
||||
const {_} = useLingui()
|
||||
const {currentAccount} = useSession()
|
||||
const [isPTR, setIsPTR] = React.useState(false)
|
||||
|
||||
const augmentedQuery = React.useMemo(() => {
|
||||
return augmentSearchQuery(query || '', {did: currentAccount?.did})
|
||||
}, [query, currentAccount])
|
||||
|
||||
const {
|
||||
isFetched,
|
||||
data: results,
|
||||
|
@ -200,7 +206,7 @@ function SearchScreenPostResults({query}: {query: string}) {
|
|||
fetchNextPage,
|
||||
isFetchingNextPage,
|
||||
hasNextPage,
|
||||
} = useSearchPostsQuery({query})
|
||||
} = useSearchPostsQuery({query: augmentedQuery})
|
||||
|
||||
const onPullToRefresh = React.useCallback(async () => {
|
||||
setIsPTR(true)
|
||||
|
@ -319,13 +325,9 @@ export function SearchScreenInner({
|
|||
const pal = usePalette('default')
|
||||
const setMinimalShellMode = useSetMinimalShellMode()
|
||||
const setDrawerSwipeDisabled = useSetDrawerSwipeDisabled()
|
||||
const {hasSession, currentAccount} = useSession()
|
||||
const {hasSession} = useSession()
|
||||
const {isDesktop} = useWebMediaQueries()
|
||||
|
||||
const augmentedQuery = React.useMemo(() => {
|
||||
return augmentSearchQuery(query || '', {did: currentAccount?.did})
|
||||
}, [query, currentAccount])
|
||||
|
||||
const onPageSelected = React.useCallback(
|
||||
(index: number) => {
|
||||
setMinimalShellMode(false)
|
||||
|
@ -347,7 +349,7 @@ export function SearchScreenInner({
|
|||
)}
|
||||
initialPage={0}>
|
||||
<View>
|
||||
<SearchScreenPostResults query={augmentedQuery} />
|
||||
<SearchScreenPostResults query={query} />
|
||||
</View>
|
||||
<View>
|
||||
<SearchScreenUserResults query={query} />
|
||||
|
|
Loading…
Reference in New Issue