-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(vue): Add TanStack Router integration #18547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
logaretm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice!
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
s1gr1d
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid implementation, nice readme for the E2E test, well documented lines (e.g. in the config files), well-used span attributes and readable code 💯
|
|
||
| const initialWindowLocation = WINDOW.location; | ||
| if (instrumentPageLoad && initialWindowLocation) { | ||
| const matchedRoutes = router.matchRoutes( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this always return an array? Because you do matchedRoutes.length later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They don't really have the docs/types ready yet, but it does so in their react version: https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType#matchroutes-method so I think this is probably going to be fine.
| ...routeMatchToParamSpanAttributes(lastMatch), | ||
| }, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Pageload span starts at wrong time
startBrowserTracingPageLoadSpan is called without a startTime, so the pageload root span starts “now” (during afterAllSetup) instead of at the navigation time origin. This can skew pageload transaction timing and related performance interpretation compared to the default browser tracing behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair, same thing exists in the other tanstack routers. Will fix this on its own PR.
9a0effe to
e577368
Compare
| navigationSpan.setAttributes(routeMatchToParamSpanAttributes(onResolvedLastMatch)); | ||
| } | ||
| } | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Navigation listeners may leak on aborted navigations
Each onBeforeNavigate call registers an onResolved subscription that only unsubscribes inside the onResolved callback. If a navigation is cancelled/errors and onResolved never fires, the handler remains subscribed, potentially accumulating listeners over time and causing extra work on later navigations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also exists in the other tanstack router integrations we have, will investigate in a separate issue.
| [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue.tanstack_router', | ||
| [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: onBeforeNavigateLastMatch ? 'route' : 'url', | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Navigation spans omit URL snapshot at start
startBrowserTracingNavigationSpan is called without the url option. This prevents BrowserTracing from snapshotting the navigation URL in scope metadata at span creation time, which can lead to transactions being associated with an incorrect URL if WINDOW.location changes again before the span is sent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also fair, also exists in the other. Will fix in followup.
6ba0963 to
e6ebbc8
Compare
| : // In SSR/non-browser contexts, WINDOW.location may be undefined, so fall back to the router's location | ||
| // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
| navigationLocation?.pathname || onBeforeNavigateArgs.toLocation.pathname, | ||
| attributes: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Navigation fallback uses previous pathname
When there is no route match during onBeforeNavigate, the navigation span name falls back to WINDOW.location.pathname, which is still the pre-navigation URL. This can mislabel navigation transactions for unmatched/404 routes (or transitional states) as the previous page instead of toLocation.pathname.
Closes: #18535