better naming
parent
ebe64b828b
commit
0ff6ee2fc8
|
@ -29,17 +29,17 @@ export const profilesQueryKey = (handles: string[]) => ['profiles', handles]
|
||||||
|
|
||||||
export function useProfileQuery({
|
export function useProfileQuery({
|
||||||
did,
|
did,
|
||||||
dontInvalidate,
|
staleTime = STALE.SECONDS.FIFTEEN,
|
||||||
}: {
|
}: {
|
||||||
did: string | undefined
|
did: string | undefined
|
||||||
dontInvalidate?: boolean
|
staleTime?: number
|
||||||
}) {
|
}) {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
// WARNING
|
// WARNING
|
||||||
// this staleTime is load-bearing
|
// this staleTime is load-bearing
|
||||||
// if you remove it, the UI infinite-loops
|
// if you remove it, the UI infinite-loops
|
||||||
// -prf
|
// -prf
|
||||||
staleTime: dontInvalidate ? STALE.INFINITY : STALE.SECONDS.FIFTEEN,
|
staleTime,
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
queryKey: RQKEY(did || ''),
|
queryKey: RQKEY(did || ''),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {sanitizeDisplayName} from 'lib/strings/display-names'
|
||||||
import {sanitizeHandle} from 'lib/strings/handles'
|
import {sanitizeHandle} from 'lib/strings/handles'
|
||||||
import {makeProfileLink} from 'lib/routes/links'
|
import {makeProfileLink} from 'lib/routes/links'
|
||||||
import {useProfileQuery} from '#/state/queries/profile'
|
import {useProfileQuery} from '#/state/queries/profile'
|
||||||
|
import {STALE} from '#/state/queries'
|
||||||
|
|
||||||
export function UserInfoText({
|
export function UserInfoText({
|
||||||
type = 'md',
|
type = 'md',
|
||||||
|
@ -29,7 +30,10 @@ export function UserInfoText({
|
||||||
attr = attr || 'handle'
|
attr = attr || 'handle'
|
||||||
failed = failed || 'user'
|
failed = failed || 'user'
|
||||||
|
|
||||||
const {data: profile, isError} = useProfileQuery({did, dontInvalidate: true})
|
const {data: profile, isError} = useProfileQuery({
|
||||||
|
did,
|
||||||
|
staleTime: STALE.INFINITY,
|
||||||
|
})
|
||||||
|
|
||||||
let inner
|
let inner
|
||||||
if (isError) {
|
if (isError) {
|
||||||
|
|
Loading…
Reference in New Issue