@tanstack/solid-router
Version:
Modern and scalable routing for Solid applications
1 lines • 2.03 kB
Source Map (JSON)
{"version":3,"file":"not-found.cjs","names":["isNotFound","CatchBoundary","useRouterState","Solid","NotFoundError","CatchNotFound","props","fallback","error","JSX","Element","onCatch","Error","children","resetKey","select","s","location","pathname","status","_$createComponent","getResetKey","errorComponent","DefaultGlobalNotFound","_tmpl$"],"sources":["../../src/not-found.tsx"],"sourcesContent":["import { isNotFound } from '@tanstack/router-core'\nimport { CatchBoundary } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport type * as Solid from 'solid-js'\nimport type { NotFoundError } from '@tanstack/router-core'\n\nexport function CatchNotFound(props: {\n fallback?: (error: NotFoundError) => Solid.JSX.Element\n onCatch?: (error: Error) => void\n children: Solid.JSX.Element\n}) {\n // TODO: Some way for the user to programmatically reset the not-found boundary?\n const resetKey = useRouterState({\n select: (s) => `not-found-${s.location.pathname}-${s.status}`,\n })\n\n return (\n <CatchBoundary\n getResetKey={() => resetKey()}\n onCatch={(error) => {\n if (isNotFound(error)) {\n props.onCatch?.(error)\n } else {\n throw error\n }\n }}\n errorComponent={({ error }) => {\n if (isNotFound(error)) {\n return props.fallback?.(error)\n } else {\n throw error\n }\n }}\n >\n {props.children}\n </CatchBoundary>\n )\n}\n\nexport function DefaultGlobalNotFound() {\n return <p>Not Found</p>\n}\n"],"mappings":";;;;;;;AAMA,SAAgBK,cAAcC,OAI3B;CAED,MAAMQ,WAAWZ,uBAAAA,eAAe,EAC9Ba,SAASC,MAAM,aAAaA,EAAEC,SAASC,SAAQ,GAAIF,EAAEG,UACtD,CAAC;AAEF,SAAA,GAAA,aAAA,iBACGlB,sBAAAA,eAAa;EACZoB,mBAAmBP,UAAU;EAC7BH,UAAUH,UAAU;AAClB,QAAA,GAAA,sBAAA,YAAeA,MAAM,CACnBF,OAAMK,UAAUH,MAAM;OAEtB,OAAMA;;EAGVc,iBAAiB,EAAEd,YAAY;AAC7B,QAAA,GAAA,sBAAA,YAAeA,MAAM,CACnB,QAAOF,MAAMC,WAAWC,MAAM;OAE9B,OAAMA;;EAET,IAAAK,WAAA;AAAA,UAEAP,MAAMO;;EAAQ,CAAA;;AAKrB,SAAgBU,wBAAwB;AACtC,QAAAC,QAAA"}