Skip to content

Commit bf7633a

Browse files
committed
Address seer's review
1 parent e7270bc commit bf7633a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/react/src/reactrouter-compat-utils/instrumentation.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,10 +768,20 @@ function patchSpanEnd(
768768
// Last chance to update the transaction name with the latest route info
769769
// Use the live global allRoutes Set to include any lazy routes loaded after patching
770770
const currentAllRoutes = Array.from(allRoutes);
771-
const branches = _matchRoutes(currentAllRoutes || routes, location, basename) as unknown as RouteMatch[];
771+
const branches = _matchRoutes(
772+
currentAllRoutes.length > 0 ? currentAllRoutes : routes,
773+
location,
774+
basename,
775+
) as unknown as RouteMatch[];
772776

773777
if (branches) {
774-
const [name, source] = resolveRouteNameAndSource(location, routes, currentAllRoutes, branches, basename);
778+
const [name, source] = resolveRouteNameAndSource(
779+
location,
780+
routes,
781+
currentAllRoutes.length > 0 ? currentAllRoutes : routes,
782+
branches,
783+
basename,
784+
);
775785

776786
// Only update if we have a valid name
777787
if (name && (spanType === 'pageload' || !spanJson.timestamp)) {

0 commit comments

Comments
 (0)