Revise cache times (#1942)

(cherry picked from commit 1be2060a2b81741dcf9a392160af87d2747b3497)
zio/stable
Eric Bailey 2023-11-16 17:43:53 -06:00 committed by GitHub
parent 1952705ded
commit 6f57192bd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 14 additions and 14 deletions

View File

@ -9,7 +9,7 @@ export const RQKEY = () => ['app-passwords']
export function useAppPasswordsQuery() {
const {agent} = useSession()
return useQuery({
staleTime: STALE.INFINITY,
staleTime: STALE.MINUTES.ONE,
queryKey: RQKEY(),
queryFn: async () => {
const res = await agent.com.atproto.server.listAppPasswords({})

View File

@ -18,7 +18,7 @@ export function useListMembersQuery(uri: string) {
QueryKey,
RQPageParam
>({
staleTime: STALE.INFINITY,
staleTime: STALE.MINUTES.ONE,
queryKey: RQKEY(uri),
async queryFn({pageParam}: {pageParam: RQPageParam}) {
const res = await agent.app.bsky.graph.getList({

View File

@ -40,7 +40,7 @@ export interface ListMembersip {
export function useDangerousListMembershipsQuery() {
const {agent, currentAccount} = useSession()
return useQuery<ListMembersip[]>({
staleTime: STALE.INFINITY,
staleTime: STALE.MINUTES.FIVE,
queryKey: RQKEY(),
async queryFn() {
if (!currentAccount) {

View File

@ -20,7 +20,7 @@ export const RQKEY = (uri: string) => ['list', uri]
export function useListQuery(uri?: string) {
const {agent} = useSession()
return useQuery<AppBskyGraphDefs.ListView, Error>({
staleTime: STALE.INFINITY,
staleTime: STALE.MINUTES.ONE,
queryKey: RQKEY(uri || ''),
async queryFn() {
if (!uri) {

View File

@ -16,7 +16,7 @@ export function useMyBlockedAccountsQuery() {
QueryKey,
RQPageParam
>({
staleTime: STALE.INFINITY,
staleTime: STALE.MINUTES.ONE,
queryKey: RQKEY(),
async queryFn({pageParam}: {pageParam: RQPageParam}) {
const res = await agent.app.bsky.graph.getBlocks({

View File

@ -11,7 +11,7 @@ export const RQKEY = (filter: MyListsFilter) => ['my-lists', filter]
export function useMyListsQuery(filter: MyListsFilter) {
const {agent, currentAccount} = useSession()
return useQuery<AppBskyGraphDefs.ListView[]>({
staleTime: STALE.INFINITY,
staleTime: STALE.MINUTES.ONE,
queryKey: RQKEY(filter),
async queryFn() {
let lists: AppBskyGraphDefs.ListView[] = []

View File

@ -16,7 +16,7 @@ export function useMyMutedAccountsQuery() {
QueryKey,
RQPageParam
>({
staleTime: STALE.INFINITY,
staleTime: STALE.MINUTES.ONE,
queryKey: RQKEY(),
async queryFn({pageParam}: {pageParam: RQPageParam}) {
const res = await agent.app.bsky.graph.getMutes({

View File

@ -34,7 +34,7 @@ export function usePreferencesQuery() {
const {agent, hasSession} = useSession()
return useQuery({
enabled: hasSession,
staleTime: STALE.INFINITY,
staleTime: STALE.MINUTES.ONE,
queryKey: usePreferencesQueryKey,
queryFn: async () => {
const res = await agent.getPreferences()

View File

@ -13,7 +13,7 @@ export const RQKEY = (did: string) => ['profile-extra-info', did]
export function useProfileExtraInfoQuery(did: string) {
const {agent} = useSession()
return useQuery({
staleTime: STALE.INFINITY,
staleTime: STALE.MINUTES.ONE,
queryKey: RQKEY(did),
async queryFn() {
const [listsRes, feedsRes] = await Promise.all([

View File

@ -23,7 +23,7 @@ export function useProfileFeedgensQuery(
QueryKey,
RQPageParam
>({
staleTime: STALE.INFINITY,
staleTime: STALE.MINUTES.ONE,
queryKey: RQKEY(did),
async queryFn({pageParam}: {pageParam: RQPageParam}) {
const res = await agent.app.bsky.feed.getActorFeeds({

View File

@ -19,7 +19,7 @@ export function useProfileFollowsQuery(did: string | undefined) {
QueryKey,
RQPageParam
>({
staleTime: STALE.INFINITY,
staleTime: STALE.MINUTES.ONE,
queryKey: RQKEY(did || ''),
async queryFn({pageParam}: {pageParam: RQPageParam}) {
const res = await agent.app.bsky.graph.getFollows({

View File

@ -19,7 +19,7 @@ export function useProfileListsQuery(did: string, opts?: {enabled?: boolean}) {
QueryKey,
RQPageParam
>({
staleTime: STALE.INFINITY,
staleTime: STALE.MINUTES.ONE,
queryKey: RQKEY(did),
async queryFn({pageParam}: {pageParam: RQPageParam}) {
const res = await agent.app.bsky.graph.getLists({

View File

@ -16,7 +16,7 @@ export function useSuggestedFeedsQuery() {
QueryKey,
string | undefined
>({
staleTime: STALE.INFINITY,
staleTime: STALE.HOURS.ONE,
queryKey: suggestedFeedsQueryKey,
queryFn: async ({pageParam}) => {
const res = await agent.app.bsky.feed.getSuggestedFeeds({

View File

@ -34,7 +34,7 @@ export function useSuggestedFollowsQuery() {
string | undefined
>({
enabled: !!moderationOpts,
staleTime: STALE.INFINITY,
staleTime: STALE.HOURS.ONE,
queryKey: suggestedFollowsQueryKey,
queryFn: async ({pageParam}) => {
const res = await agent.app.bsky.actor.getSuggestions({