diff --git a/contributors.yml b/contributors.yml index b6384a4eb9..448d95be8c 100644 --- a/contributors.yml +++ b/contributors.yml @@ -428,6 +428,7 @@ - xavier-lc - xcsnowcity - xdaxer +- y-nk - yionr - yracnet - ytori diff --git a/packages/react-router/lib/hooks.tsx b/packages/react-router/lib/hooks.tsx index 047866d6a9..c2aeec3da5 100644 --- a/packages/react-router/lib/hooks.tsx +++ b/packages/react-router/lib/hooks.tsx @@ -26,10 +26,10 @@ import { import type { Blocker, BlockerFunction, - RelativeRoutingType, Router as DataRouter, - RevalidationState, Navigation, + RelativeRoutingType, + RevalidationState, } from "./router/router"; import { IDLE_BLOCKER } from "./router/router"; import type { @@ -1394,12 +1394,12 @@ export function useRevalidator(): { * @mode data * @returns An array of {@link UIMatch | UI matches} for the current route hierarchy */ -export function useMatches(): UIMatch[] { +export function useMatches(): UIMatch[] { let { matches, loaderData } = useDataRouterState( DataRouterStateHook.UseMatches, ); return React.useMemo( - () => matches.map((m) => convertRouteMatchToUiMatch(m, loaderData)), + () => matches.map((m) => convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData], ); } diff --git a/packages/react-router/lib/router/utils.ts b/packages/react-router/lib/router/utils.ts index 9aa6fede50..5d51fed3cd 100644 --- a/packages/react-router/lib/router/utils.ts +++ b/packages/react-router/lib/router/utils.ts @@ -942,10 +942,10 @@ export interface UIMatch { handle: Handle; } -export function convertRouteMatchToUiMatch( +export function convertRouteMatchToUiMatch( match: AgnosticDataRouteMatch, loaderData: RouteData, -): UIMatch { +): UIMatch { let { route, pathname, params } = match; return { id: route.id,