Skip to content

Commit e330a61

Browse files
committed
fix(web): retry startup after the server recovers
1 parent 20363c3 commit e330a61

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";
@@ -336,7 +337,8 @@ function HostedStaticEnvironmentBootstrap() {
336337
return null;
337338
}
338339

339-
function RootRouteErrorView({ error, reset }: ErrorComponentProps) {
340+
function RootRouteErrorView({ error }: ErrorComponentProps) {
341+
const router = useRouter();
340342
const message = errorMessage(error);
341343
// Router pathname rather than window.location: desktop uses hash history, where the window path is always "/".
342344
const pathname = useLocation({ select: (location) => location.pathname });
@@ -359,7 +361,7 @@ function RootRouteErrorView({ error, reset }: ErrorComponentProps) {
359361
<p className="mt-2 text-sm leading-relaxed text-muted-foreground">{message}</p>
360362

361363
<div className="mt-5 flex flex-wrap gap-2">
362-
<Button size="sm" onClick={() => reset()}>
364+
<Button size="sm" onClick={() => void router.invalidate()}>
363365
Try again
364366
</Button>
365367
<Button size="sm" variant="outline" onClick={() => window.location.reload()}>

0 commit comments

Comments
 (0)