Skip to content

Commit 00e2e5e

Browse files
committed
fix(web): retry startup after the server recovers
1 parent 7bd7f99 commit 00e2e5e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/web/src/routes/__root.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
type ErrorComponentProps,
99
useLocation,
1010
useNavigate,
11+
useRouter,
1112
} from "@tanstack/react-router";
1213
import { CheckIcon, CopyIcon } from "lucide-react";
1314
import { useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
@@ -332,7 +333,8 @@ function HostedStaticEnvironmentBootstrap() {
332333
return null;
333334
}
334335

335-
function RootRouteErrorView({ error, reset }: ErrorComponentProps) {
336+
function RootRouteErrorView({ error }: ErrorComponentProps) {
337+
const router = useRouter();
336338
const message = errorMessage(error);
337339
// Router pathname rather than window.location: desktop uses hash history, where the window path is always "/".
338340
const pathname = useLocation({ select: (location) => location.pathname });
@@ -355,7 +357,7 @@ function RootRouteErrorView({ error, reset }: ErrorComponentProps) {
355357
<p className="mt-2 text-sm leading-relaxed text-muted-foreground">{message}</p>
356358

357359
<div className="mt-5 flex flex-wrap gap-2">
358-
<Button size="sm" onClick={() => reset()}>
360+
<Button size="sm" onClick={() => void router.invalidate()}>
359361
Try again
360362
</Button>
361363
<Button size="sm" variant="outline" onClick={() => window.location.reload()}>

0 commit comments

Comments
 (0)