File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,9 @@ export function tanstackRouterBrowserTracingIntegration(
6464 if ( instrumentNavigation ) {
6565 // 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
6666 castRouterInstance . subscribe ( 'onBeforeNavigate' , onBeforeNavigateArgs => {
67+ const fromLocationState = onBeforeNavigateArgs . fromLocation && onBeforeNavigateArgs . fromLocation . state ;
6768 // 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 ) {
6970 return ;
7071 }
7172
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export interface VendoredTanstackRouter {
4646 eventType : 'onResolved' | 'onBeforeNavigate' ,
4747 callback : ( stateUpdate : {
4848 toLocation : VendoredTanstackRouterLocation ;
49- fromLocation : VendoredTanstackRouterLocation ;
49+ fromLocation ? : VendoredTanstackRouterLocation ;
5050 } ) => void ,
5151 ) : ( ) => void ;
5252}
You can’t perform that action at this time.
0 commit comments