From 181c7570e8ff25cec795676ecc89d3c04d5db682 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 27 Jun 2024 03:25:34 +0800 Subject: [PATCH] feat: filter routeParams param --- src/renderer/src/lib/path-parser.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/lib/path-parser.ts b/src/renderer/src/lib/path-parser.ts index 65944cfb0..9f33160ed 100644 --- a/src/renderer/src/lib/path-parser.ts +++ b/src/renderer/src/lib/path-parser.ts @@ -95,11 +95,13 @@ export const parseRegexpPathParams = (regexpPath: string) => { const array: PathParams[] = [] for (const item of pathToRegexp(transformedPath).keys) { - array.push({ - name: item.name, - optional: item.modifier === "?" || item.modifier === "*", - isCatchAll: item.name === CATCH_ALL_GROUP_KEY || item.modifier === "*", - }) + if (item.name !== "routeParams") { + array.push({ + name: item.name, + optional: item.modifier === "?" || item.modifier === "*", + isCatchAll: item.name === CATCH_ALL_GROUP_KEY || item.modifier === "*", + }) + } } const map = array.reduce((acc, { name, optional, isCatchAll }) => {