From cedc015aaa8e1968480a9e2ab98f76cf837f146d Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Sun, 16 Aug 2026 16:16:52 +0000 Subject: [PATCH] perf(router-core): skip the cleanPath regex when there are no double slashes joinPaths and resolvePath call cleanPath on every navigation. Paths without '//' can return as-is. --- packages/router-core/src/path.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/router-core/src/path.ts b/packages/router-core/src/path.ts index da410e9c7d..f6fada8e57 100644 --- a/packages/router-core/src/path.ts +++ b/packages/router-core/src/path.ts @@ -22,7 +22,8 @@ export function joinPaths(paths: Array) { /** Remove repeated slashes from a path string. */ export function cleanPath(path: string) { - // remove double slashes + // Most paths never contain '//' — skip the regex on that common case. + if (path.indexOf('//') === -1) return path return path.replace(/\/{2,}/g, '/') }