Merge pull request #2679 from bluesky-social/hailey/check-blocks-load-profile

clear cache when blocking/unblocking and whenever we get blocked, better invalidation logic for `useProfileQuery`
This commit is contained in:
Hailey 2024-01-30 10:35:46 -08:00 committed by GitHub
commit 4058174678
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 48 additions and 13 deletions

View file

@ -27,12 +27,12 @@ export function Component({did}: {did: string}) {
data: profile,
error: profileError,
refetch: refetchProfile,
isFetching: isFetchingProfile,
isLoading: isLoadingProfile,
} = useProfileQuery({
did: did,
})
if (isFetchingProfile || !moderationOpts) {
if (isLoadingProfile || !moderationOpts) {
return (
<CenteredView style={[pal.view, s.flex1]}>
<ProfileHeader

View file

@ -9,6 +9,7 @@ import {sanitizeDisplayName} from 'lib/strings/display-names'
import {sanitizeHandle} from 'lib/strings/handles'
import {makeProfileLink} from 'lib/routes/links'
import {useProfileQuery} from '#/state/queries/profile'
import {STALE} from '#/state/queries'
export function UserInfoText({
type = 'md',
@ -29,7 +30,10 @@ export function UserInfoText({
attr = attr || 'handle'
failed = failed || 'user'
const {data: profile, isError} = useProfileQuery({did})
const {data: profile, isError} = useProfileQuery({
did,
staleTime: STALE.INFINITY,
})
let inner
if (isError) {