@@ -7,7 +7,11 @@ import {
77
88import { browserTracingIntegration as originalBrowserTracingIntegration } from '@sentry/browser' ;
99import 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' ;
1115
1216/**
1317 * A custom browser tracing integration for TanStack Router.
@@ -40,8 +44,10 @@ export function tanstackRouterBrowserTracingIntegration(
4044 const initialWindowLocation = WINDOW . location ;
4145 if ( instrumentPageLoad && initialWindowLocation ) {
4246 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 ,
4551 { preload : false , throwOnError : false } ,
4652 ) ;
4753
@@ -66,11 +72,10 @@ export function tanstackRouterBrowserTracingIntegration(
6672 return ;
6773 }
6874
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+ } ) ;
7479
7580 const onBeforeNavigateLastMatch = onResolvedMatchedRoutes [ onResolvedMatchedRoutes . length - 1 ] ;
7681
@@ -88,11 +93,10 @@ export function tanstackRouterBrowserTracingIntegration(
8893 const unsubscribeOnResolved = castRouterInstance . subscribe ( 'onResolved' , onResolvedArgs => {
8994 unsubscribeOnResolved ( ) ;
9095 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+ } ) ;
96100
97101 const onResolvedLastMatch = onResolvedMatchedRoutes [ onResolvedMatchedRoutes . length - 1 ] ;
98102
0 commit comments