Skip to content

Commit 66164ac

Browse files
committed
Utilize passed allRoutes in patched spanEnd
1 parent 5c0d2f0 commit 66164ac

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,9 @@ function patchSpanEnd(
939939
return;
940940
}
941941

942+
// Use the passed route context, or fall back to global Set
943+
const allRoutesSet = _allRoutes ? new Set(_allRoutes) : allRoutes;
944+
942945
const originalEnd = span.end.bind(span);
943946
let endCalled = false;
944947

@@ -974,7 +977,7 @@ function patchSpanEnd(
974977

975978
if (shouldWaitForLazyRoutes) {
976979
if (_lazyRouteTimeout === 0) {
977-
tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, routes, basename, spanType, allRoutes);
980+
tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, routes, basename, spanType, allRoutesSet);
978981
return originalEnd(...args);
979982
}
980983

@@ -995,7 +998,7 @@ function patchSpanEnd(
995998
routes,
996999
basename,
9971000
spanType,
998-
allRoutes,
1001+
allRoutesSet,
9991002
);
10001003
originalEnd(...args);
10011004
})
@@ -1005,7 +1008,7 @@ function patchSpanEnd(
10051008
return;
10061009
}
10071010

1008-
tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, routes, basename, spanType, allRoutes);
1011+
tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, routes, basename, spanType, allRoutesSet);
10091012
return originalEnd(...args);
10101013
};
10111014

0 commit comments

Comments
 (0)