From 94b2530f2f9ea0e0efdf6e933f6160105265a2c6 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 21 Apr 2024 14:56:43 -0300 Subject: challenger preact api --- packages/web-util/src/utils/route.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'packages/web-util/src/utils/route.ts') diff --git a/packages/web-util/src/utils/route.ts b/packages/web-util/src/utils/route.ts index 4f8a020f6..494a61efa 100644 --- a/packages/web-util/src/utils/route.ts +++ b/packages/web-util/src/utils/route.ts @@ -74,7 +74,7 @@ export function findMatch>( pagesMap: T, pageList: Array, path: string, - params: Record, + params: Record, ): Location | undefined { for (let idx = 0; idx < pageList.length; idx++) { const name = pageList[idx]; @@ -82,10 +82,6 @@ export function findMatch>( if (found !== null) { const values = {} as Record; - Object.entries(params).forEach(([key, value]) => { - values[key] = value; - }); - if (found.groups !== undefined) { Object.entries(found.groups).forEach(([key, value]) => { values[key] = value; @@ -93,7 +89,7 @@ export function findMatch>( } // @ts-expect-error values is a map string which is equivalent to the RouteParamsType - return { name, parent: pagesMap, values }; + return { name, parent: pagesMap, values, params }; } } return undefined; @@ -117,6 +113,7 @@ type MapKeyValue = { parent: Type; name: Key; values: RouteParamsType; + params: Record; } : never; }; -- cgit v1.2.3