authorgravatar for 91240327+shivamhwp@users.noreply.github.comshivam <91240327+shivamhwp@users.noreply.github.com> 2026-09-13 21:25:17+05:30
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-13 12:55:17-03:00
log4a39cade982926f607b4606d0f8d92a807f4b0bf
tree0db13fdf099000aa3660db95881b1b7b5b7baf63
parent20363c32c9bfdbf49c2716ef11d1f18483fcc01b
signature Signed by PGP key B5690EEEBB952194

fix(web): offer recovery from missing pages (#11314)


1 files changed, 17 insertions(+), 0 deletions(-)

apps/web/src/routes/__root.tsx+17
...@@ -3,6 +3,7 @@ import { scopedProjectKey, scopeProjectRef } from "@t3tools/client-runtime/envir...@@ -3,6 +3,7 @@ import { scopedProjectKey, scopeProjectRef } from "@t3tools/client-runtime/envir
3import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";3import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
4import {4import {
5 Outlet,5 Outlet,
6 Link,
6 redirect,7 redirect,
7 createRootRoute,8 createRootRoute,
8 type ErrorComponentProps,9 type ErrorComponentProps,
...@@ -104,11 +105,27 @@ export const Route = createRootRoute({...@@ -104,11 +105,27 @@ export const Route = createRootRoute({
104 },105 },
105 component: RootRouteView,106 component: RootRouteView,
106 errorComponent: RootRouteErrorView,107 errorComponent: RootRouteErrorView,
108 notFoundComponent: RootRouteNotFoundView,
107 head: () => ({109 head: () => ({
108 meta: [{ name: "title", content: APP_DISPLAY_NAME }],110 meta: [{ name: "title", content: APP_DISPLAY_NAME }],
109 }),111 }),
110});112});
111113
114function RootRouteNotFoundView() {
115 return (
116 <main className="flex min-h-0 min-w-0 flex-1 items-center justify-center p-6">
117 <div className="flex max-w-sm flex-col items-center gap-4 text-center">
118 <h1 className="text-lg font-medium text-foreground">Page not found</h1>
119 <p className="text-sm text-muted-foreground">
120 This link doesn't point to a page in {APP_DISPLAY_NAME}. Go home to choose a project or
121 start a thread.
122 </p>
123 <Button render={<Link to="/" replace />}>Go home</Button>
124 </div>
125 </main>
126 );
127}
128
112function RootRouteView() {129function RootRouteView() {
113 useEffect(() => installDesktopPasteAsText(window.desktopBridge, window), []);130 useEffect(() => installDesktopPasteAsText(window.desktopBridge, window), []);
114 const pathname = useLocation({ select: (location) => location.pathname });131 const pathname = useLocation({ select: (location) => location.pathname });