Open History to see the last commit
1import {
2 ErrorComponent,
3 Link,
4 useLocation,
5 useRouter,
6} from '@tanstack/solid-router'
7import type { ErrorComponentProps } from '@tanstack/solid-router'
8β
9export function DefaultCatchBoundary({ error }: ErrorComponentProps) {
10 const router = useRouter()
11 const isRoot = useLocation({
12 select: (location) => location.pathname === '/',
13 })
14β
15 console.error('DefaultCatchBoundary Error:', error)
16β
17 return (
18 <div class="min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6">
19 <ErrorComponent error={error} />
20 <div class="flex gap-2 items-center flex-wrap">
21 <button
22 onClick={() => {
23 router.invalidate()
24 }}
25 class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`}
26 >
27 Try Again
28 </button>
29 {isRoot() ? (
30 <Link
31 to="/"
32 class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`}
33 >
34 Home
35 </Link>
36 ) : (
37 <Link
38 to="/"
39 class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`}
40 onClick={(e) => {
41 e.preventDefault()
42 window.history.back()
43 }}
44 >
45 Go Back
46 </Link>
47 )}
48 </div>
49 </div>
50 )
51}