Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): retry startup after the server recovers #11291

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/11291/headmerged by maria-rcks View on GitHub

Showing 1 changed file with 4 additions and 2 deletions.

x
0 of 1 viewed, 1 left
4 additions and 2 deletionsapps/web/src/routes/__root.tsxModified
View file
@@ -8,6 +8,7 @@
type ErrorComponentProps,
useLocation,
useNavigate,
+ useRouter,
} from "@tanstack/react-router";
import { CheckIcon, CopyIcon } from "lucide-react";
import { useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
@@ -336,7 +337,8 @@
return null;
​
-function RootRouteErrorView({ error, reset }: ErrorComponentProps) {
+function RootRouteErrorView({ error }: ErrorComponentProps) {
+ const router = useRouter();
const message = errorMessage(error);
// Router pathname rather than window.location: desktop uses hash history, where the window path is always "/".
const pathname = useLocation({ select: (location) => location.pathname });
@@ -359,7 +361,7 @@
<p className="mt-2 text-sm leading-relaxed text-muted-foreground">{message}</p>
​
<div className="mt-5 flex flex-wrap gap-2">
- <Button size="sm" onClick={() => reset()}>
+ <Button size="sm" onClick={() => void router.invalidate()}>
Try again
</Button>
<Button size="sm" variant="outline" onClick={() => window.location.reload()}>