diff options
author | Samuel Newman <mozzius@protonmail.com> | 2025-02-24 12:39:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-24 12:39:41 -0800 |
commit | 3d954a00e009f85433e4b5f43d0d1960c8f6c639 (patch) | |
tree | a9825276647d9d57f33364bd37392a013ac2ac55 /src | |
parent | f9392d4a9688c1ea1bff962c857ff4ae543e46fe (diff) | |
download | voidsky-3d954a00e009f85433e4b5f43d0d1960c8f6c639.tar.zst |
precache recent profile click (#7831)
Diffstat (limited to 'src')
-rw-r--r-- | src/view/screens/Search/Search.tsx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/view/screens/Search/Search.tsx b/src/view/screens/Search/Search.tsx index b6d75b274..02be8cf83 100644 --- a/src/view/screens/Search/Search.tsx +++ b/src/view/screens/Search/Search.tsx @@ -18,6 +18,7 @@ import { import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useFocusEffect, useNavigation, useRoute} from '@react-navigation/native' +import {useQueryClient} from '@tanstack/react-query' import {APP_LANGUAGES, LANGUAGES} from '#/lib/../locale/languages' import {createHitslop, HITSLOP_20} from '#/lib/constants' @@ -42,7 +43,10 @@ import {useModerationOpts} from '#/state/preferences/moderation-opts' import {useActorAutocompleteQuery} from '#/state/queries/actor-autocomplete' import {useActorSearch} from '#/state/queries/actor-search' import {usePopularFeedsSearch} from '#/state/queries/feed' -import {useProfilesQuery} from '#/state/queries/profile' +import { + unstableCacheProfileView, + useProfilesQuery, +} from '#/state/queries/profile' import {useSearchPostsQuery} from '#/state/queries/search-posts' import {useSession} from '#/state/session' import {useSetMinimalShellMode} from '#/state/shell' @@ -622,6 +626,7 @@ export function SearchScreenShell({ const {_} = useLingui() const setMinimalShellMode = useSetMinimalShellMode() const {currentAccount} = useSession() + const queryClient = useQueryClient() // Query terms const [searchText, setSearchText] = React.useState<string>(queryParam) @@ -768,12 +773,13 @@ export function SearchScreenShell({ const handleProfileClick = React.useCallback( (profile: bsky.profile.AnyProfileView) => { + unstableCacheProfileView(queryClient, profile) // Slight delay to avoid updating during push nav animation. setTimeout(() => { updateProfileHistory(profile) }, 400) }, - [updateProfileHistory], + [updateProfileHistory, queryClient], ) const onSoftReset = React.useCallback(() => { |