Tune queries

This commit is contained in:
xmflsct 2023-01-09 19:18:48 +01:00
parent be772f905d
commit b9c4b139f5
2 changed files with 6 additions and 12 deletions

View File

@ -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) {

View File

@ -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: () => {}
}
})