File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,13 @@ 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- // 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 ) {
67+ // onBeforeNavigate is called during pageloads. We can avoid creating navigation spans by:
68+ // 1. Checking if there's no fromLocation (initial pageload)
69+ // 2. Comparing the states of the to and from arguments
70+ if (
71+ ! onBeforeNavigateArgs . fromLocation ||
72+ onBeforeNavigateArgs . toLocation . state === onBeforeNavigateArgs . fromLocation . state
73+ ) {
6974 return ;
7075 }
7176
You can’t perform that action at this time.
0 commit comments