Bluesky app fork with some witchin' additions 💫

Caching heuristics (#1938)

* Tempfix profile load

* First pass at staleTime

authored by

Eric Bailey and committed by
GitHub
6dfb2a23 f89dc638

+122 -22
+3 -4
src/state/queries/actor-autocomplete.ts
··· 5 5 import {logger} from '#/logger' 6 6 import {useSession} from '#/state/session' 7 7 import {useMyFollowsQuery} from '#/state/queries/my-follows' 8 + import {STALE} from '#/state/queries' 8 9 9 10 export const RQKEY = (prefix: string) => ['actor-autocomplete', prefix] 10 11 ··· 13 14 const {data: follows, isFetching} = useMyFollowsQuery() 14 15 15 16 return useQuery<AppBskyActorDefs.ProfileViewBasic[]>({ 16 - // cached for 1 min 17 - staleTime: 60 * 1000, 17 + staleTime: STALE.MINUTES.ONE, 18 18 queryKey: RQKEY(prefix || ''), 19 19 async queryFn() { 20 20 const res = prefix ··· 41 41 if (query) { 42 42 try { 43 43 res = await queryClient.fetchQuery({ 44 - // cached for 1 min 45 - staleTime: 60 * 1000, 44 + staleTime: STALE.MINUTES.ONE, 46 45 queryKey: RQKEY(query || ''), 47 46 queryFn: () => 48 47 agent.searchActorsTypeahead({
+4 -1
src/state/queries/app-passwords.ts
··· 1 1 import {ComAtprotoServerCreateAppPassword} from '@atproto/api' 2 2 import {useQuery, useQueryClient, useMutation} from '@tanstack/react-query' 3 - import {useSession} from '../session' 3 + 4 + import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 4 6 5 7 export const RQKEY = () => ['app-passwords'] 6 8 7 9 export function useAppPasswordsQuery() { 8 10 const {agent} = useSession() 9 11 return useQuery({ 12 + staleTime: STALE.INFINITY, 10 13 queryKey: RQKEY(), 11 14 queryFn: async () => { 12 15 const res = await agent.com.atproto.server.listAppPasswords({})
+2
src/state/queries/feed.ts
··· 20 20 import {sanitizeHandle} from '#/lib/strings/handles' 21 21 import {useSession} from '#/state/session' 22 22 import {usePreferencesQuery} from '#/state/queries/preferences' 23 + import {STALE} from '#/state/queries' 23 24 24 25 export type FeedSourceFeedInfo = { 25 26 type: 'feed' ··· 139 140 const type = getFeedTypeFromUri(uri) 140 141 141 142 return useQuery({ 143 + staleTime: STALE.INFINITY, 142 144 queryKey: feedSourceInfoQueryKey({uri}), 143 145 queryFn: async () => { 144 146 let view: FeedSourceInfo
+9
src/state/queries/handle.ts
··· 2 2 import {useQueryClient, useMutation} from '@tanstack/react-query' 3 3 4 4 import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 5 6 6 7 const fetchHandleQueryKey = (handleOrDid: string) => ['handle', handleOrDid] 7 8 const fetchDidQueryKey = (handleOrDid: string) => ['did', handleOrDid] ··· 14 15 async (handleOrDid: string) => { 15 16 if (handleOrDid.startsWith('did:')) { 16 17 const res = await queryClient.fetchQuery({ 18 + staleTime: STALE.MINUTES.FIVE, 17 19 queryKey: fetchHandleQueryKey(handleOrDid), 18 20 queryFn: () => agent.getProfile({actor: handleOrDid}), 19 21 }) ··· 27 29 28 30 export function useUpdateHandleMutation() { 29 31 const {agent} = useSession() 32 + const queryClient = useQueryClient() 30 33 31 34 return useMutation({ 32 35 mutationFn: async ({handle}: {handle: string}) => { 33 36 await agent.updateHandle({handle}) 34 37 }, 38 + onSuccess(_data, variables) { 39 + queryClient.invalidateQueries({ 40 + queryKey: fetchHandleQueryKey(variables.handle), 41 + }) 42 + }, 35 43 }) 36 44 } 37 45 ··· 42 50 return React.useCallback( 43 51 async (handleOrDid: string) => { 44 52 return queryClient.fetchQuery({ 53 + staleTime: STALE.INFINITY, 45 54 queryKey: fetchDidQueryKey(handleOrDid), 46 55 queryFn: async () => { 47 56 let identifier = handleOrDid
+11
src/state/queries/index.ts
··· 3 3 export const PUBLIC_BSKY_AGENT = new BskyAgent({ 4 4 service: 'https://api.bsky.app', 5 5 }) 6 + 7 + export const STALE = { 8 + MINUTES: { 9 + ONE: 1e3 * 60, 10 + FIVE: 1e3 * 60 * 5, 11 + }, 12 + HOURS: { 13 + ONE: 1e3 * 60 * 60, 14 + }, 15 + INFINITY: Infinity, 16 + }
+2
src/state/queries/invites.ts
··· 2 2 import {useQuery} from '@tanstack/react-query' 3 3 4 4 import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 5 6 6 7 function isInviteAvailable(invite: ComAtprotoServerDefs.InviteCode): boolean { 7 8 return invite.available - invite.uses.length > 0 && !invite.disabled ··· 15 16 const {agent} = useSession() 16 17 17 18 return useQuery({ 19 + staleTime: STALE.HOURS.ONE, 18 20 queryKey: ['inviteCodes'], 19 21 queryFn: async () => { 20 22 const res = await agent.com.atproto.server.getAccountInviteCodes({})
+4 -1
src/state/queries/list-members.ts
··· 1 1 import {AppBskyGraphGetList} from '@atproto/api' 2 2 import {useInfiniteQuery, InfiniteData, QueryKey} from '@tanstack/react-query' 3 - import {useSession} from '../session' 3 + 4 + import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 4 6 5 7 const PAGE_SIZE = 30 6 8 type RQPageParam = string | undefined ··· 16 18 QueryKey, 17 19 RQPageParam 18 20 >({ 21 + staleTime: STALE.INFINITY, 19 22 queryKey: RQKEY(uri), 20 23 async queryFn({pageParam}: {pageParam: RQPageParam}) { 21 24 const res = await agent.app.bsky.graph.getList({
+5 -2
src/state/queries/list-memberships.ts
··· 16 16 17 17 import {AtUri} from '@atproto/api' 18 18 import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query' 19 - import {useSession} from '../session' 20 - import {RQKEY as LIST_MEMBERS_RQKEY} from './list-members' 19 + 20 + import {useSession} from '#/state/session' 21 + import {RQKEY as LIST_MEMBERS_RQKEY} from '#/state/queries/list-members' 22 + import {STALE} from '#/state/queries' 21 23 22 24 // sanity limit is SANITY_PAGE_LIMIT*PAGE_SIZE total records 23 25 const SANITY_PAGE_LIMIT = 1000 ··· 38 40 export function useDangerousListMembershipsQuery() { 39 41 const {agent, currentAccount} = useSession() 40 42 return useQuery<ListMembersip[]>({ 43 + staleTime: STALE.INFINITY, 41 44 queryKey: RQKEY(), 42 45 async queryFn() { 43 46 if (!currentAccount) {
+2
src/state/queries/list.ts
··· 13 13 import {RQKEY as PROFILE_LISTS_RQKEY} from './profile-lists' 14 14 import {uploadBlob} from '#/lib/api' 15 15 import {until} from '#/lib/async/until' 16 + import {STALE} from '#/state/queries' 16 17 17 18 export const RQKEY = (uri: string) => ['list', uri] 18 19 19 20 export function useListQuery(uri?: string) { 20 21 const {agent} = useSession() 21 22 return useQuery<AppBskyGraphDefs.ListView, Error>({ 23 + staleTime: STALE.INFINITY, 22 24 queryKey: RQKEY(uri || ''), 23 25 async queryFn() { 24 26 if (!uri) {
+4 -1
src/state/queries/my-blocked-accounts.ts
··· 1 1 import {AppBskyGraphGetBlocks} from '@atproto/api' 2 2 import {useInfiniteQuery, InfiniteData, QueryKey} from '@tanstack/react-query' 3 - import {useSession} from '../session' 3 + 4 + import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 4 6 5 7 export const RQKEY = () => ['my-blocked-accounts'] 6 8 type RQPageParam = string | undefined ··· 14 16 QueryKey, 15 17 RQPageParam 16 18 >({ 19 + staleTime: STALE.INFINITY, 17 20 queryKey: RQKEY(), 18 21 async queryFn({pageParam}: {pageParam: RQPageParam}) { 19 22 const res = await agent.app.bsky.graph.getBlocks({
+2
src/state/queries/my-follows.ts
··· 1 1 import {AppBskyActorDefs} from '@atproto/api' 2 2 import {useQuery} from '@tanstack/react-query' 3 3 import {useSession} from '../session' 4 + import {STALE} from '#/state/queries' 4 5 5 6 // sanity limit is SANITY_PAGE_LIMIT*PAGE_SIZE total records 6 7 const SANITY_PAGE_LIMIT = 1000 ··· 12 13 export function useMyFollowsQuery() { 13 14 const {agent, currentAccount} = useSession() 14 15 return useQuery<AppBskyActorDefs.ProfileViewBasic[]>({ 16 + staleTime: STALE.MINUTES.ONE, 15 17 queryKey: RQKEY(), 16 18 async queryFn() { 17 19 if (!currentAccount) {
+5 -2
src/state/queries/my-lists.ts
··· 1 1 import {AppBskyGraphDefs} from '@atproto/api' 2 2 import {useQuery, QueryClient} from '@tanstack/react-query' 3 - import {accumulate} from 'lib/async/accumulate' 4 - import {useSession} from '../session' 3 + 4 + import {accumulate} from '#/lib/async/accumulate' 5 + import {useSession} from '#/state/session' 6 + import {STALE} from '#/state/queries' 5 7 6 8 export type MyListsFilter = 'all' | 'curate' | 'mod' 7 9 export const RQKEY = (filter: MyListsFilter) => ['my-lists', filter] ··· 9 11 export function useMyListsQuery(filter: MyListsFilter) { 10 12 const {agent, currentAccount} = useSession() 11 13 return useQuery<AppBskyGraphDefs.ListView[]>({ 14 + staleTime: STALE.INFINITY, 12 15 queryKey: RQKEY(filter), 13 16 async queryFn() { 14 17 let lists: AppBskyGraphDefs.ListView[] = []
+4 -1
src/state/queries/my-muted-accounts.ts
··· 1 1 import {AppBskyGraphGetMutes} from '@atproto/api' 2 2 import {useInfiniteQuery, InfiniteData, QueryKey} from '@tanstack/react-query' 3 - import {useSession} from '../session' 3 + 4 + import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 4 6 5 7 export const RQKEY = () => ['my-muted-accounts'] 6 8 type RQPageParam = string | undefined ··· 14 16 QueryKey, 15 17 RQPageParam 16 18 >({ 19 + staleTime: STALE.INFINITY, 17 20 queryKey: RQKEY(), 18 21 async queryFn({pageParam}: {pageParam: RQPageParam}) { 19 22 const res = await agent.app.bsky.graph.getMutes({
+2
src/state/queries/notifications/feed.ts
··· 12 12 import {useModerationOpts} from '../preferences' 13 13 import {shouldFilterNotif} from './util' 14 14 import {useMutedThreads} from '#/state/muted-threads' 15 + import {STALE} from '#/state/queries' 15 16 16 17 const GROUPABLE_REASONS = ['like', 'repost', 'follow'] 17 18 const PAGE_SIZE = 30 ··· 60 61 QueryKey, 61 62 RQPageParam 62 63 >({ 64 + staleTime: STALE.INFINITY, 63 65 queryKey: RQKEY(), 64 66 async queryFn({pageParam}: {pageParam: RQPageParam}) { 65 67 const res = await agent.listNotifications({
+2
src/state/queries/post-feed.ts
··· 13 13 import {MergeFeedAPI} from 'lib/api/feed/merge' 14 14 import {useModerationOpts} from '#/state/queries/preferences' 15 15 import {logger} from '#/logger' 16 + import {STALE} from '#/state/queries' 16 17 17 18 type ActorDid = string 18 19 type AuthorFilter = ··· 132 133 QueryKey, 133 134 RQPageParam 134 135 >({ 136 + staleTime: STALE.INFINITY, 135 137 queryKey: RQKEY(feedDesc, params), 136 138 async queryFn({pageParam}: {pageParam: RQPageParam}) { 137 139 console.log('fetch', feedDesc, pageParam)
+5 -1
src/state/queries/post-liked-by.ts
··· 1 1 import {AppBskyFeedGetLikes} from '@atproto/api' 2 2 import {useInfiniteQuery, InfiniteData, QueryKey} from '@tanstack/react-query' 3 - import {useSession} from '../session' 3 + 4 + import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 4 6 5 7 const PAGE_SIZE = 30 6 8 type RQPageParam = string | undefined 7 9 10 + // TODO refactor invalidate on mutate? 8 11 export const RQKEY = (resolvedUri: string) => ['post-liked-by', resolvedUri] 9 12 10 13 export function usePostLikedByQuery(resolvedUri: string | undefined) { ··· 16 19 QueryKey, 17 20 RQPageParam 18 21 >({ 22 + staleTime: STALE.MINUTES.ONE, 19 23 queryKey: RQKEY(resolvedUri || ''), 20 24 async queryFn({pageParam}: {pageParam: RQPageParam}) { 21 25 const res = await agent.getLikes({
+5 -1
src/state/queries/post-reposted-by.ts
··· 1 1 import {AppBskyFeedGetRepostedBy} from '@atproto/api' 2 2 import {useInfiniteQuery, InfiniteData, QueryKey} from '@tanstack/react-query' 3 - import {useSession} from '../session' 3 + 4 + import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 4 6 5 7 const PAGE_SIZE = 30 6 8 type RQPageParam = string | undefined 7 9 10 + // TODO refactor invalidate on mutate? 8 11 export const RQKEY = (resolvedUri: string) => ['post-reposted-by', resolvedUri] 9 12 10 13 export function usePostRepostedByQuery(resolvedUri: string | undefined) { ··· 16 19 QueryKey, 17 20 RQPageParam 18 21 >({ 22 + staleTime: STALE.MINUTES.ONE, 19 23 queryKey: RQKEY(resolvedUri || ''), 20 24 async queryFn({pageParam}: {pageParam: RQPageParam}) { 21 25 const res = await agent.getRepostedBy({
+3
src/state/queries/post-thread.ts
··· 4 4 AppBskyFeedGetPostThread, 5 5 } from '@atproto/api' 6 6 import {useQuery} from '@tanstack/react-query' 7 + 7 8 import {useSession} from '#/state/session' 8 9 import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types' 10 + import {STALE} from '#/state/queries' 9 11 10 12 export const RQKEY = (uri: string) => ['post-thread', uri] 11 13 type ThreadViewNode = AppBskyFeedGetPostThread.OutputSchema['thread'] ··· 58 60 export function usePostThreadQuery(uri: string | undefined) { 59 61 const {agent} = useSession() 60 62 return useQuery<ThreadNode, Error>({ 63 + staleTime: STALE.MINUTES.ONE, 61 64 queryKey: RQKEY(uri || ''), 62 65 async queryFn() { 63 66 const res = await agent.getPostThread({uri: uri!})
+6 -2
src/state/queries/post.ts
··· 1 1 import React from 'react' 2 2 import {AppBskyFeedDefs, AtUri} from '@atproto/api' 3 3 import {useQuery, useMutation, useQueryClient} from '@tanstack/react-query' 4 - import {useSession} from '../session' 5 - import {updatePostShadow} from '../cache/post-shadow' 4 + 5 + import {useSession} from '#/state/session' 6 + import {updatePostShadow} from '#/state/cache/post-shadow' 7 + import {STALE} from '#/state/queries' 6 8 7 9 export const RQKEY = (postUri: string) => ['post', postUri] 8 10 9 11 export function usePostQuery(uri: string | undefined) { 10 12 const {agent} = useSession() 11 13 return useQuery<AppBskyFeedDefs.PostView>({ 14 + staleTime: STALE.MINUTES.ONE, 12 15 queryKey: RQKEY(uri || ''), 13 16 async queryFn() { 14 17 const res = await agent.getPosts({uris: [uri!]}) ··· 28 31 return React.useCallback( 29 32 async ({uri}: {uri: string}) => { 30 33 return queryClient.fetchQuery({ 34 + staleTime: STALE.MINUTES.ONE, 31 35 queryKey: RQKEY(uri || ''), 32 36 async queryFn() { 33 37 const urip = new AtUri(uri)
+2
src/state/queries/preferences/index.ts
··· 22 22 DEFAULT_THREAD_VIEW_PREFS, 23 23 } from '#/state/queries/preferences/const' 24 24 import {getModerationOpts} from '#/state/queries/preferences/moderation' 25 + import {STALE} from '#/state/queries' 25 26 26 27 export * from '#/state/queries/preferences/types' 27 28 export * from '#/state/queries/preferences/moderation' ··· 33 34 const {agent, hasSession} = useSession() 34 35 return useQuery({ 35 36 enabled: hasSession, 37 + staleTime: STALE.INFINITY, 36 38 queryKey: usePreferencesQueryKey, 37 39 queryFn: async () => { 38 40 const res = await agent.getPreferences()
+5 -1
src/state/queries/profile-extra-info.ts
··· 1 1 import {useQuery} from '@tanstack/react-query' 2 - import {useSession} from '../session' 2 + 3 + import {useSession} from '#/state/session' 4 + import {STALE} from '#/state/queries' 3 5 6 + // TODO refactor invalidate on mutate? 4 7 export const RQKEY = (did: string) => ['profile-extra-info', did] 5 8 6 9 /** ··· 10 13 export function useProfileExtraInfoQuery(did: string) { 11 14 const {agent} = useSession() 12 15 return useQuery({ 16 + staleTime: STALE.INFINITY, 13 17 queryKey: RQKEY(did), 14 18 async queryFn() { 15 19 const [listsRes, feedsRes] = await Promise.all([
+5 -1
src/state/queries/profile-feedgens.ts
··· 1 1 import {AppBskyFeedGetActorFeeds} from '@atproto/api' 2 2 import {useInfiniteQuery, InfiniteData, QueryKey} from '@tanstack/react-query' 3 - import {useSession} from '../session' 3 + 4 + import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 4 6 5 7 const PAGE_SIZE = 30 6 8 type RQPageParam = string | undefined 7 9 10 + // TODO refactor invalidate on mutate? 8 11 export const RQKEY = (did: string) => ['profile-feedgens', did] 9 12 10 13 export function useProfileFeedgensQuery( ··· 20 23 QueryKey, 21 24 RQPageParam 22 25 >({ 26 + staleTime: STALE.INFINITY, 23 27 queryKey: RQKEY(did), 24 28 async queryFn({pageParam}: {pageParam: RQPageParam}) { 25 29 const res = await agent.app.bsky.feed.getActorFeeds({
+4 -1
src/state/queries/profile-followers.ts
··· 1 1 import {AppBskyGraphGetFollowers} from '@atproto/api' 2 2 import {useInfiniteQuery, InfiniteData, QueryKey} from '@tanstack/react-query' 3 - import {useSession} from '../session' 3 + 4 + import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 4 6 5 7 const PAGE_SIZE = 30 6 8 type RQPageParam = string | undefined ··· 16 18 QueryKey, 17 19 RQPageParam 18 20 >({ 21 + staleTime: STALE.MINUTES.FIVE, 19 22 queryKey: RQKEY(did || ''), 20 23 async queryFn({pageParam}: {pageParam: RQPageParam}) { 21 24 const res = await agent.app.bsky.graph.getFollowers({
+5 -1
src/state/queries/profile-follows.ts
··· 1 1 import {AppBskyGraphGetFollows} from '@atproto/api' 2 2 import {useInfiniteQuery, InfiniteData, QueryKey} from '@tanstack/react-query' 3 - import {useSession} from '../session' 3 + 4 + import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 4 6 5 7 const PAGE_SIZE = 30 6 8 type RQPageParam = string | undefined 7 9 10 + // TODO refactor invalidate on mutate? 8 11 export const RQKEY = (did: string) => ['profile-follows', did] 9 12 10 13 export function useProfileFollowsQuery(did: string | undefined) { ··· 16 19 QueryKey, 17 20 RQPageParam 18 21 >({ 22 + staleTime: STALE.INFINITY, 19 23 queryKey: RQKEY(did || ''), 20 24 async queryFn({pageParam}: {pageParam: RQPageParam}) { 21 25 const res = await agent.app.bsky.graph.getFollows({
+4 -1
src/state/queries/profile-lists.ts
··· 1 1 import {AppBskyGraphGetLists} from '@atproto/api' 2 2 import {useInfiniteQuery, InfiniteData, QueryKey} from '@tanstack/react-query' 3 - import {useSession} from '../session' 3 + 4 + import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 4 6 5 7 const PAGE_SIZE = 30 6 8 type RQPageParam = string | undefined ··· 17 19 QueryKey, 18 20 RQPageParam 19 21 >({ 22 + staleTime: STALE.INFINITY, 20 23 queryKey: RQKEY(did), 21 24 async queryFn({pageParam}: {pageParam: RQPageParam}) { 22 25 const res = await agent.app.bsky.graph.getLists({
+6
src/state/queries/profile.ts
··· 16 16 import {useToggleMutationQueue} from '#/lib/hooks/useToggleMutationQueue' 17 17 import {RQKEY as RQKEY_MY_MUTED} from './my-muted-accounts' 18 18 import {RQKEY as RQKEY_MY_BLOCKED} from './my-blocked-accounts' 19 + import {STALE} from '#/state/queries' 19 20 20 21 export const RQKEY = (did: string) => ['profile', did] 21 22 22 23 export function useProfileQuery({did}: {did: string | undefined}) { 23 24 const {agent} = useSession() 24 25 return useQuery({ 26 + staleTime: STALE.MINUTES.FIVE, 25 27 queryKey: RQKEY(did || ''), 26 28 queryFn: async () => { 27 29 const res = await agent.getProfile({actor: did || ''}) ··· 304 306 305 307 function useProfileUnmuteMutation() { 306 308 const {agent} = useSession() 309 + const queryClient = useQueryClient() 307 310 return useMutation<void, Error, {did: string; skipOptimistic?: boolean}>({ 308 311 mutationFn: async ({did}) => { 309 312 await agent.unmute(did) ··· 315 318 muted: false, 316 319 }) 317 320 } 321 + }, 322 + onSuccess() { 323 + queryClient.invalidateQueries({queryKey: RQKEY_MY_MUTED()}) 318 324 }, 319 325 onError(error, variables) { 320 326 if (!variables.skipOptimistic) {
+4 -1
src/state/queries/resolve-uri.ts
··· 1 1 import {useQuery} from '@tanstack/react-query' 2 2 import {AtUri} from '@atproto/api' 3 - import {useSession} from '../session' 3 + 4 + import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 4 6 5 7 export const RQKEY = (uri: string) => ['resolved-uri', uri] 6 8 7 9 export function useResolveUriQuery(uri: string | undefined) { 8 10 const {agent} = useSession() 9 11 return useQuery<{uri: string; did: string}, Error>({ 12 + staleTime: STALE.INFINITY, 10 13 queryKey: RQKEY(uri || ''), 11 14 async queryFn() { 12 15 const urip = new AtUri(uri || '')
+3
src/state/queries/service.ts
··· 1 1 import {BskyAgent} from '@atproto/api' 2 2 import {useQuery} from '@tanstack/react-query' 3 3 4 + import {STALE} from '#/state/queries' 5 + 4 6 export const RQKEY = (serviceUrl: string) => ['service', serviceUrl] 5 7 6 8 export function useServiceQuery(serviceUrl: string) { 7 9 return useQuery({ 10 + staleTime: STALE.HOURS.ONE, 8 11 queryKey: RQKEY(serviceUrl), 9 12 queryFn: async () => { 10 13 const agent = new BskyAgent({service: serviceUrl})
+2
src/state/queries/suggested-feeds.ts
··· 2 2 import {AppBskyFeedGetSuggestedFeeds} from '@atproto/api' 3 3 4 4 import {useSession} from '#/state/session' 5 + import {STALE} from '#/state/queries' 5 6 6 7 export const suggestedFeedsQueryKey = ['suggestedFeeds'] 7 8 ··· 15 16 QueryKey, 16 17 string | undefined 17 18 >({ 19 + staleTime: STALE.INFINITY, 18 20 queryKey: suggestedFeedsQueryKey, 19 21 queryFn: async ({pageParam}) => { 20 22 const res = await agent.app.bsky.feed.getSuggestedFeeds({
+2
src/state/queries/suggested-follows.ts
··· 14 14 15 15 import {useSession} from '#/state/session' 16 16 import {useModerationOpts} from '#/state/queries/preferences' 17 + import {STALE} from '#/state/queries' 17 18 18 19 const suggestedFollowsQueryKey = ['suggested-follows'] 19 20 const suggestedFollowsByActorQueryKey = (did: string) => [ ··· 33 34 string | undefined 34 35 >({ 35 36 enabled: !!moderationOpts, 37 + staleTime: STALE.INFINITY, 36 38 queryKey: suggestedFollowsQueryKey, 37 39 queryFn: async ({pageParam}) => { 38 40 const res = await agent.app.bsky.actor.getSuggestions({