diff --git a/packages/solid-router/src/Match.tsx b/packages/solid-router/src/Match.tsx index b5dff1cd5fb..c16ae808b05 100644 --- a/packages/solid-router/src/Match.tsx +++ b/packages/solid-router/src/Match.tsx @@ -388,6 +388,11 @@ export const Outlet = () => { const shouldShowNotFound = () => childMatchStatus() !== 'redirected' && parentGlobalNotFound() + const rootErrorComponent = () => + router.routesById[rootRouteId]?.options.errorComponent ?? + router.options.defaultErrorComponent + const rootResetKey = useRouterState({ select: (s) => s.loadedAt }) + return ( { } > {(matchIdAccessor) => { - // Use a memo to avoid stale accessor errors while keeping reactivity const currentMatchId = Solid.createMemo(() => matchIdAccessor()) + const childMatch = () => + return ( } + fallback={childMatch()} > } > - + {rootErrorComponent() ? ( + rootResetKey()} + errorComponent={rootErrorComponent()!} + onCatch={(error) => { + if (isNotFound(error)) throw error + }} + > + {childMatch()} + + ) : ( + childMatch() + )} )