Skip to content

Commit 60f2ce9

Browse files
authored
fix: Do not trigger session on meaningless navigation (#3608)
Avoid double-reporting on initial navigation, and omit sessions for navigation API events that do not change the URL.
1 parent 82a868f commit 60f2ce9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/browser/src/sdk.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,11 @@ function startSessionTracking(): void {
204204

205205
// We want to create a session for every navigation as well
206206
addInstrumentationHandler({
207-
callback: () => {
207+
callback: ({ from, to }) => {
208+
// Don't create an additional session for the initial route or if the location did not change
209+
if (from === undefined || from === to) {
210+
return;
211+
}
208212
hub.startSession();
209213
hub.captureSession();
210214
},

0 commit comments

Comments
 (0)