Revise cache times (#1942)
(cherry picked from commit 1be2060a2b81741dcf9a392160af87d2747b3497)zio/stable
parent
1952705ded
commit
6f57192bd5
|
@ -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({})
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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[] = []
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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([
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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({
|
||||
|
|
Loading…
Reference in New Issue