From cc94123b6211c4e5c321fc638b2f31c4dba4fafe Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 18 Aug 2025 13:22:53 +0200 Subject: [PATCH] fix: matcher --- .../route-resolver/matchers/matcher-pattern.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/router/src/experimental/route-resolver/matchers/matcher-pattern.ts b/packages/router/src/experimental/route-resolver/matchers/matcher-pattern.ts index e2dcacda..419418ce 100644 --- a/packages/router/src/experimental/route-resolver/matchers/matcher-pattern.ts +++ b/packages/router/src/experimental/route-resolver/matchers/matcher-pattern.ts @@ -211,9 +211,17 @@ export class MatcherPatternPathDynamic< paramOptions = this.params[paramName] value = (paramOptions.set || identityFn)(params[paramName]) - return Array.isArray(value) - ? value.map(encodeParam).join('/') - : encodeParam(value) + // param cannot be repeatable when in a sub segment + if (__DEV__ && paramOptions.repeat) { + warn( + `Param "${String(paramName)}" is repeatable, but used in a sub segment of the path: "${this.pathParts.join('')}". Repeated params can only be used as a full path segment: "/file/[ids]+/something-else". This will break in production.` + ) + return Array.isArray(value) + ? value.map(encodeParam).join('/') + : encodeParam(value) + } + + return encodeParam(value as string | null | undefined) }) .join('') } -- 2.47.3