UNPKG

@tanstack/solid-router

Version:

Modern and scalable routing for Solid applications

30 lines (29 loc) 936 B
import { CatchBoundary } from "./CatchBoundary.js"; import { useRouterState } from "./useRouterState.js"; import { isNotFound } from "@tanstack/router-core"; import { createComponent, template } from "solid-js/web"; //#region src/not-found.tsx var _tmpl$ = /* @__PURE__ */ template(`<p>Not Found`); function CatchNotFound(props) { const resetKey = useRouterState({ select: (s) => `not-found-${s.location.pathname}-${s.status}` }); return createComponent(CatchBoundary, { getResetKey: () => resetKey(), onCatch: (error) => { if (isNotFound(error)) props.onCatch?.(error); else throw error; }, errorComponent: ({ error }) => { if (isNotFound(error)) return props.fallback?.(error); else throw error; }, get children() { return props.children; } }); } function DefaultGlobalNotFound() { return _tmpl$(); } //#endregion export { CatchNotFound, DefaultGlobalNotFound }; //# sourceMappingURL=not-found.js.map