mirror of
https://github.com/tooot-app/app
synced 2025-01-31 10:44:58 +01:00
Tune queries
This commit is contained in:
parent
be772f905d
commit
b9c4b139f5
@ -30,7 +30,7 @@ const TimelineCard: React.FC = () => {
|
||||
|
||||
const statusQuery = useStatusQuery({
|
||||
status: match?.status ? { ...match.status, uri: status.card.url } : undefined,
|
||||
options: { enabled: false, retry: 1 }
|
||||
options: { enabled: false, retry: false }
|
||||
})
|
||||
useEffect(() => {
|
||||
if (match?.status) {
|
||||
@ -47,7 +47,7 @@ const TimelineCard: React.FC = () => {
|
||||
|
||||
const accountQuery = useAccountQuery({
|
||||
account: match?.account ? { ...match?.account, url: status.card.url } : undefined,
|
||||
options: { enabled: false, retry: 1 }
|
||||
options: { enabled: false, retry: false }
|
||||
})
|
||||
useEffect(() => {
|
||||
if (match?.account) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { QueryClient } from '@tanstack/react-query'
|
||||
|
||||
export const globalRetry = (failureCount: number) => failureCount <= 2
|
||||
|
||||
export const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
@ -8,17 +10,9 @@ export const queryClient = new QueryClient({
|
||||
if ([401, 404].includes(error?.status)) {
|
||||
return false
|
||||
}
|
||||
if (failureCount <= 2) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
return globalRetry(failureCount)
|
||||
}
|
||||
}
|
||||
},
|
||||
logger: {
|
||||
log: log => console.log(log),
|
||||
warn: () => {},
|
||||
error: () => {}
|
||||
}
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user