From b0bf7260a262684e0493cb26cf04f2b5e6ae9770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Zugmeyer?= Date: Mon, 18 Nov 2024 19:05:37 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=97=EF=B8=8F=F0=9F=90=9B=20[RUM-6226]=20f?= =?UTF-8?q?ix=20for=20empty=20splats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When matching the route `/*` with the path `/`, the '*' param is an empty string (obviously). In that case, we shouldn't consider the '*' as missing and proceed with replacing the star. --- .../src/domain/reactRouterV6/startReactRouterView.spec.ts | 2 ++ .../rum-react/src/domain/reactRouterV6/startReactRouterView.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/rum-react/src/domain/reactRouterV6/startReactRouterView.spec.ts b/packages/rum-react/src/domain/reactRouterV6/startReactRouterView.spec.ts index 8990b65ced..315bf81a3b 100644 --- a/packages/rum-react/src/domain/reactRouterV6/startReactRouterView.spec.ts +++ b/packages/rum-react/src/domain/reactRouterV6/startReactRouterView.spec.ts @@ -70,9 +70,11 @@ describe('computeViewName', () => { // Splats ['*', '/foo/1', '/foo/1'], + ['*', '/', '/'], ['/foo/*', '/foo/1', '/foo/1'], ['/foo > *', '/foo/1', '/foo/1'], ['* > *', '/foo/1', '/foo/1'], + ['* > *', '/', '/'], ['/foo/* > *', '/foo/1', '/foo/1'], ['* > foo/*', '/foo/1', '/foo/1'], ['/foo/* > bar/*', '/foo/bar/1', '/foo/bar/1'], diff --git a/packages/rum-react/src/domain/reactRouterV6/startReactRouterView.ts b/packages/rum-react/src/domain/reactRouterV6/startReactRouterView.ts index d2e0a2403f..0b6328ed21 100644 --- a/packages/rum-react/src/domain/reactRouterV6/startReactRouterView.ts +++ b/packages/rum-react/src/domain/reactRouterV6/startReactRouterView.ts @@ -58,7 +58,7 @@ function substitutePathSplats(path: string, params: Record