@@ -7,7 +7,11 @@ import {
7
7
8
8
import { browserTracingIntegration as originalBrowserTracingIntegration } from '@sentry/browser' ;
9
9
import type { Integration } from '@sentry/types' ;
10
- import type { VendoredTanstackRouter , VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types' ;
10
+ import type {
11
+ VendoredTanstackRouter ,
12
+ VendoredTanstackRouterLocation ,
13
+ VendoredTanstackRouterRouteMatch ,
14
+ } from './vendor/tanstackrouter-types' ;
11
15
12
16
/**
13
17
* A custom browser tracing integration for TanStack Router.
@@ -40,8 +44,10 @@ export function tanstackRouterBrowserTracingIntegration(
40
44
const initialWindowLocation = WINDOW . location ;
41
45
if ( instrumentPageLoad && initialWindowLocation ) {
42
46
const matchedRoutes = castRouterInstance . matchRoutes (
43
- initialWindowLocation . pathname ,
44
- initialWindowLocation . search ,
47
+ {
48
+ pathname : initialWindowLocation . pathname ,
49
+ search : castRouterInstance . options . parseSearch ( initialWindowLocation . search ) ,
50
+ } as VendoredTanstackRouterLocation ,
45
51
{ preload : false , throwOnError : false } ,
46
52
) ;
47
53
@@ -66,11 +72,10 @@ export function tanstackRouterBrowserTracingIntegration(
66
72
return ;
67
73
}
68
74
69
- const onResolvedMatchedRoutes = castRouterInstance . matchRoutes (
70
- onBeforeNavigateArgs . toLocation . pathname ,
71
- onBeforeNavigateArgs . toLocation . search ,
72
- { preload : false , throwOnError : false } ,
73
- ) ;
75
+ const onResolvedMatchedRoutes = castRouterInstance . matchRoutes ( onBeforeNavigateArgs . toLocation , {
76
+ preload : false ,
77
+ throwOnError : false ,
78
+ } ) ;
74
79
75
80
const onBeforeNavigateLastMatch = onResolvedMatchedRoutes [ onResolvedMatchedRoutes . length - 1 ] ;
76
81
@@ -88,11 +93,10 @@ export function tanstackRouterBrowserTracingIntegration(
88
93
const unsubscribeOnResolved = castRouterInstance . subscribe ( 'onResolved' , onResolvedArgs => {
89
94
unsubscribeOnResolved ( ) ;
90
95
if ( navigationSpan ) {
91
- const onResolvedMatchedRoutes = castRouterInstance . matchRoutes (
92
- onResolvedArgs . toLocation . pathname ,
93
- onResolvedArgs . toLocation . search ,
94
- { preload : false , throwOnError : false } ,
95
- ) ;
96
+ const onResolvedMatchedRoutes = castRouterInstance . matchRoutes ( onResolvedArgs . toLocation , {
97
+ preload : false ,
98
+ throwOnError : false ,
99
+ } ) ;
96
100
97
101
const onResolvedLastMatch = onResolvedMatchedRoutes [ onResolvedMatchedRoutes . length - 1 ] ;
98
102
0 commit comments