File tree 2 files changed +3
-2
lines changed
2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,9 @@ export function tanstackRouterBrowserTracingIntegration(
64
64
if ( instrumentNavigation ) {
65
65
// The onBeforeNavigate hook is called at the very beginning of a navigation and is only called once per navigation, even when the user is redirected
66
66
castRouterInstance . subscribe ( 'onBeforeNavigate' , onBeforeNavigateArgs => {
67
+ const fromLocationState = onBeforeNavigateArgs . fromLocation && onBeforeNavigateArgs . fromLocation . state ;
67
68
// onBeforeNavigate is called during pageloads. We can avoid creating navigation spans by comparing the states of the to and from arguments.
68
- if ( onBeforeNavigateArgs . toLocation . state === onBeforeNavigateArgs . fromLocation . state ) {
69
+ if ( onBeforeNavigateArgs . toLocation . state === fromLocationState ) {
69
70
return ;
70
71
}
71
72
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export interface VendoredTanstackRouter {
46
46
eventType : 'onResolved' | 'onBeforeNavigate' ,
47
47
callback : ( stateUpdate : {
48
48
toLocation : VendoredTanstackRouterLocation ;
49
- fromLocation : VendoredTanstackRouterLocation ;
49
+ fromLocation ? : VendoredTanstackRouterLocation ;
50
50
} ) => void ,
51
51
) : ( ) => void ;
52
52
}
You can’t perform that action at this time.
0 commit comments