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:
stacksmash76 2022-11-10 12:32:57 +01:00 committed by GitHub
parent b6ba23d0ee
commit 1b6fd01575
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -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.

View file

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