Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/react/src/reactrouterv6.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ let _createRoutesFromChildren: CreateRoutesFromChildren;
let _matchRoutes: MatchRoutes;
let _stripBasename: boolean = false;

const CLIENTS_WITH_INSTRUMENT_NAVIGATION: Client[] = [];
const CLIENTS_WITH_INSTRUMENT_NAVIGATION = new WeakSet<Client>();

interface ReactRouterOptions {
useEffect: UseEffect;
Expand Down Expand Up @@ -108,7 +108,7 @@ export function reactRouterV6BrowserTracingIntegration(
}

if (instrumentNavigation) {
CLIENTS_WITH_INSTRUMENT_NAVIGATION.push(client);
CLIENTS_WITH_INSTRUMENT_NAVIGATION.add(client);
}
},
};
Expand Down Expand Up @@ -222,7 +222,7 @@ function handleNavigation(
const branches = Array.isArray(matches) ? matches : _matchRoutes(routes, location, basename);

const client = getClient();
if (!client || !CLIENTS_WITH_INSTRUMENT_NAVIGATION.includes(client)) {
if (!client || !CLIENTS_WITH_INSTRUMENT_NAVIGATION.has(client)) {
return;
}

Expand Down