diff options
Diffstat (limited to 'src/state/queries/profile.ts')
-rw-r--r-- | src/state/queries/profile.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/state/queries/profile.ts b/src/state/queries/profile.ts index 267cf2c5b..21e519a0f 100644 --- a/src/state/queries/profile.ts +++ b/src/state/queries/profile.ts @@ -26,12 +26,18 @@ import {track} from '#/lib/analytics/analytics' export const RQKEY = (did: string) => ['profile', did] export function useProfileQuery({did}: {did: string | undefined}) { + const {currentAccount} = useSession() + const isCurrentAccount = did === currentAccount?.did + return useQuery({ // WARNING // this staleTime is load-bearing // if you remove it, the UI infinite-loops // -prf - staleTime: STALE.MINUTES.FIVE, + staleTime: isCurrentAccount ? STALE.SECONDS.THIRTY : STALE.MINUTES.FIVE, + refetchInterval: isCurrentAccount + ? STALE.SECONDS.THIRTY + : STALE.MINUTES.FIVE, queryKey: RQKEY(did || ''), queryFn: async () => { const res = await getAgent().getProfile({actor: did || ''}) |