precache the autosuggestion
This commit is contained in:
@@ -16,6 +16,7 @@ import {msg, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import AsyncStorage from '@react-native-async-storage/async-storage'
|
import AsyncStorage from '@react-native-async-storage/async-storage'
|
||||||
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
||||||
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
import {useAnalytics} from '#/lib/analytics/analytics'
|
||||||
import {HITSLOP_10} from '#/lib/constants'
|
import {HITSLOP_10} from '#/lib/constants'
|
||||||
@@ -42,6 +43,7 @@ import {
|
|||||||
SearchTabNavigatorParams,
|
SearchTabNavigatorParams,
|
||||||
} from 'lib/routes/types'
|
} from 'lib/routes/types'
|
||||||
import {useTheme} from 'lib/ThemeContext'
|
import {useTheme} from 'lib/ThemeContext'
|
||||||
|
import {precacheProfile} from 'state/queries/profile'
|
||||||
import {Pager} from '#/view/com/pager/Pager'
|
import {Pager} from '#/view/com/pager/Pager'
|
||||||
import {TabBar} from '#/view/com/pager/TabBar'
|
import {TabBar} from '#/view/com/pager/TabBar'
|
||||||
import {Post} from '#/view/com/post/Post'
|
import {Post} from '#/view/com/post/Post'
|
||||||
@@ -474,6 +476,7 @@ export function SearchScreen(
|
|||||||
) {
|
) {
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
|
const queryClient = useQueryClient()
|
||||||
const textInput = React.useRef<TextInput>(null)
|
const textInput = React.useRef<TextInput>(null)
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
@@ -758,6 +761,8 @@ export function SearchScreen(
|
|||||||
profile={item}
|
profile={item}
|
||||||
moderation={moderateProfile(item, moderationOpts)}
|
moderation={moderateProfile(item, moderationOpts)}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
|
precacheProfile(queryClient, item)
|
||||||
|
|
||||||
if (isWeb) {
|
if (isWeb) {
|
||||||
setInputIsFocused(false)
|
setInputIsFocused(false)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user