hezarfen_frontend
Clone
https://git.tahinli.com/Hezarfen/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import type { ErrorComponentProps } from "@tanstack/solid-router"; |
| 2 | import { PageLoadError } from "@/components/layout/page-load-error"; |
| 3 | import { RecordNotFound } from "@/components/layout/record-not-found"; |
| 4 | import { isNotFoundError } from "@/lib/record-list-path"; |
| 5 | |
| 6 | /** |
| 7 | * The router's default error component: a page that throws while rendering |
| 8 | * (typically a failed list read through `resource.latest`) shows this in |
| 9 | * place of its own content, inside the shell, so navigation keeps working. |
| 10 | * Without it the throw reached the app-wide boundary and replaced everything |
| 11 | * with a full-screen 500. |
| 12 | * |
| 13 | * It can also render for the root route, above the i18n provider, so its |
| 14 | * text comes from `pageStateText` instead of `useT()`. |
| 15 | */ |
| 16 | export function RouteErrorFallback(props: ErrorComponentProps) { |
| 17 | // A missing record is an answer, not a failure: retrying a 404 changes nothing. |
| 18 | if (isNotFoundError(props.error)) { |
| 19 | return <RecordNotFound />; |
| 20 | } |
| 21 | console.error("Route render error:", props.error); |
| 22 | return <PageLoadError error={props.error} reset={props.reset} />; |
| 23 | } |