From b0219acc73591e9a1bcf436bbc65add7202a6c14 Mon Sep 17 00:00:00 2001 From: Julien Barbay Date: Fri, 22 Aug 2025 10:52:19 +0700 Subject: [PATCH 1/2] generics for data and handle --- packages/react-router/lib/hooks.tsx | 8 ++++---- packages/react-router/lib/router/utils.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) 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, From 9003cdcca42b34abda19039cf0b5fb5c0b021918 Mon Sep 17 00:00:00 2001 From: Julien Barbay Date: Fri, 22 Aug 2025 12:03:30 +0700 Subject: [PATCH 2/2] sign cla --- contributors.yml | 1 + 1 file changed, 1 insertion(+) 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