diff --git a/src/components/Timeline/Shared/Card.tsx b/src/components/Timeline/Shared/Card.tsx index c92cb715..03d29f18 100644 --- a/src/components/Timeline/Shared/Card.tsx +++ b/src/components/Timeline/Shared/Card.tsx @@ -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) { diff --git a/src/utils/queryHooks/index.ts b/src/utils/queryHooks/index.ts index 2120a922..6c6f90e1 100644 --- a/src/utils/queryHooks/index.ts +++ b/src/utils/queryHooks/index.ts @@ -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: () => {} } })