From b5111928b9a54bcbed43881fa07a242a1b3c11ff Mon Sep 17 00:00:00 2001 From: Pedro Cattori Date: Thu, 21 Nov 2024 09:44:33 -0500 Subject: [PATCH] fix: pass route error to errorboundary as a prop --- packages/react-router-dev/vite/with-props.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-router-dev/vite/with-props.ts b/packages/react-router-dev/vite/with-props.ts index b66ce8060e..1c85d10a77 100644 --- a/packages/react-router-dev/vite/with-props.ts +++ b/packages/react-router-dev/vite/with-props.ts @@ -19,7 +19,7 @@ export const plugin: Plugin = { if (id !== VirtualModule.resolve(vmodId)) return; return dedent` import { createElement as h } from "react"; - import { useActionData, useLoaderData, useMatches, useParams } from "react-router"; + import { useActionData, useLoaderData, useMatches, useParams, useRouteError } from "react-router"; export function withComponentProps(Component) { return function Wrapped() { @@ -48,6 +48,7 @@ export const plugin: Plugin = { params: useParams(), loaderData: useLoaderData(), actionData: useActionData(), + error: useRouteError(), }; return h(ErrorBoundary, props); };