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