Skip to content

Commit 9529018

Browse files
committed
feat(solidjs): Use WeakSet to check for instrumented clients
1 parent 7131064 commit 9529018

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/solidjs/src/solidrouter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import type { Component, JSX, ParentProps } from 'solid-js';
2121
import { createComponent } from 'solid-js/web';
2222
import { DEBUG_BUILD } from './debug-build';
2323

24-
const CLIENTS_WITH_INSTRUMENT_NAVIGATION: Client[] = [];
24+
const CLIENTS_WITH_INSTRUMENT_NAVIGATION = new WeakSet<Client>();
2525

2626
type UserBeforeLeave = (listener: (e: BeforeLeaveEventArgs) => void) => void;
2727
type UseLocation = () => Location;
@@ -36,7 +36,7 @@ interface SolidRouterOptions {
3636

3737
function handleNavigation(location: string): void {
3838
const client = getClient();
39-
if (!client || !CLIENTS_WITH_INSTRUMENT_NAVIGATION.includes(client)) {
39+
if (!client || !CLIENTS_WITH_INSTRUMENT_NAVIGATION.has(client)) {
4040
return;
4141
}
4242

@@ -135,7 +135,7 @@ export function solidRouterBrowserTracingIntegration(
135135
}
136136

137137
if (instrumentNavigation) {
138-
CLIENTS_WITH_INSTRUMENT_NAVIGATION.push(client);
138+
CLIENTS_WITH_INSTRUMENT_NAVIGATION.add(client);
139139
}
140140
},
141141
};

0 commit comments

Comments
 (0)