mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
fix(web): infinitely retry queries, remove ago
from age cells (#528)
- infinitely retry web queries so we avoid the "failed to fetch" error when the web server is unavailable - remove the "ago" suffix from age cells (closes #497)
This commit is contained in:
parent
b6ba23d0ee
commit
1b6fd01575
2 changed files with 8 additions and 2 deletions
|
@ -10,7 +10,13 @@ import Toast from "./components/notifications/Toast";
|
||||||
|
|
||||||
export const queryClient = new QueryClient({
|
export const queryClient = new QueryClient({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
queries: { useErrorBoundary: true },
|
queries: {
|
||||||
|
// The retries will have exponential delay.
|
||||||
|
// See https://tanstack.com/query/v4/docs/guides/query-retries#retry-delay
|
||||||
|
// delay = Math.min(1000 * 2 ** attemptIndex, 30000)
|
||||||
|
retry: true,
|
||||||
|
useErrorBoundary: true
|
||||||
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
// Use a format string to convert the error object to a proper string without much hassle.
|
// Use a format string to convert the error object to a proper string without much hassle.
|
||||||
|
|
|
@ -12,7 +12,7 @@ interface CellProps {
|
||||||
|
|
||||||
export const AgeCell = ({ value }: CellProps) => (
|
export const AgeCell = ({ value }: CellProps) => (
|
||||||
<div className="text-sm text-gray-500" title={value}>
|
<div className="text-sm text-gray-500" title={value}>
|
||||||
{formatDistanceToNowStrict(new Date(value), { addSuffix: true })}
|
{formatDistanceToNowStrict(new Date(value), { addSuffix: false })}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue