about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/state/queries/app-passwords.ts3
-rw-r--r--src/state/queries/index.ts4
-rw-r--r--src/state/queries/invites.ts3
-rw-r--r--src/state/queries/preferences/index.ts3
-rw-r--r--src/state/queries/profile.ts8
5 files changed, 17 insertions, 4 deletions
diff --git a/src/state/queries/app-passwords.ts b/src/state/queries/app-passwords.ts
index 6a7e43610..4b9e09a8d 100644
--- a/src/state/queries/app-passwords.ts
+++ b/src/state/queries/app-passwords.ts
@@ -8,7 +8,8 @@ export const RQKEY = () => ['app-passwords']
 
 export function useAppPasswordsQuery() {
   return useQuery({
-    staleTime: STALE.MINUTES.ONE,
+    staleTime: STALE.MINUTES.FIVE,
+    refetchInterval: STALE.MINUTES.ONE,
     queryKey: RQKEY(),
     queryFn: async () => {
       const res = await getAgent().com.atproto.server.listAppPasswords({})
diff --git a/src/state/queries/index.ts b/src/state/queries/index.ts
index 35f841a93..e7c5f577b 100644
--- a/src/state/queries/index.ts
+++ b/src/state/queries/index.ts
@@ -5,6 +5,10 @@ export const PUBLIC_BSKY_AGENT = new BskyAgent({
 })
 
 export const STALE = {
+  SECONDS: {
+    FIFTEEN: 1e3 * 15,
+    THIRTY: 1e3 * 30,
+  },
   MINUTES: {
     ONE: 1e3 * 60,
     FIVE: 1e3 * 60 * 5,
diff --git a/src/state/queries/invites.ts b/src/state/queries/invites.ts
index 367917af5..a765b3098 100644
--- a/src/state/queries/invites.ts
+++ b/src/state/queries/invites.ts
@@ -15,7 +15,8 @@ export type InviteCodesQueryResponse = Exclude<
 >
 export function useInviteCodesQuery() {
   return useQuery({
-    staleTime: STALE.HOURS.ONE,
+    staleTime: STALE.MINUTES.FIVE,
+    refetchInterval: STALE.MINUTES.FIVE,
     queryKey: ['inviteCodes'],
     queryFn: async () => {
       const res = await getAgent()
diff --git a/src/state/queries/preferences/index.ts b/src/state/queries/preferences/index.ts
index 620d56862..872bb21af 100644
--- a/src/state/queries/preferences/index.ts
+++ b/src/state/queries/preferences/index.ts
@@ -28,8 +28,9 @@ export const preferencesQueryKey = ['getPreferences']
 
 export function usePreferencesQuery() {
   return useQuery({
-    staleTime: STALE.MINUTES.ONE,
+    staleTime: STALE.SECONDS.FIFTEEN,
     structuralSharing: true,
+    refetchInterval: STALE.SECONDS.FIFTEEN,
     queryKey: preferencesQueryKey,
     queryFn: async () => {
       const agent = getAgent()
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 || ''})