feat(solid): Add route parametrization for Solid Router#20031
Conversation
This PR adds route parametrization for the solidRouterBrowserTracingIntegration. It replaces raw URLs (e.g. /users/5) with parametrized routes (e.g. /users/:id) in transaction names.
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Deps
Nuxt
Other
Bug Fixes 🐛
Documentation 📚
Internal Changes 🔧Core
Deps
Deps Dev
Other
🤖 This preview updates automatically when you update the PR. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Negative assertion checks wrong source, weakening regression test
- Changed test assertions from 'route' to 'url' to match the source value at span creation time when spanStart event fires.
- ✅ Fixed: Numeric navigation deltas beyond -1 block effect updates
- Updated pendingNavigationTarget guard to use regex pattern /^-\d+$/ to handle all numeric deltas, not just -1.
Or push these changes by commenting:
@cursor push 98f020cc69
Preview (98f020cc69)
diff --git a/packages/solid/src/solidrouter.ts b/packages/solid/src/solidrouter.ts
--- a/packages/solid/src/solidrouter.ts
+++ b/packages/solid/src/solidrouter.ts
@@ -91,9 +91,9 @@
// transition completes. In that case, location.pathname still points
// to the old route while the active span is already the navigation span.
// Skip the update to avoid overwriting the span with stale route data.
- // `-1` is solid router's representation of a browser back-button
- // navigation, where we don't know the target URL upfront.
- if (pendingNavigationTarget && pendingNavigationTarget !== '-1' && name !== pendingNavigationTarget) {
+ // Numeric deltas (e.g., `-1`, `-2`) are solid router's representation of
+ // browser back/forward navigations, where we don't know the target URL upfront.
+ if (pendingNavigationTarget && !pendingNavigationTarget.match(/^-\d+$/) && name !== pendingNavigationTarget) {
return;
}
pendingNavigationTarget = undefined;
diff --git a/packages/solid/test/solidrouter.test.tsx b/packages/solid/test/solidrouter.test.tsx
--- a/packages/solid/test/solidrouter.test.tsx
+++ b/packages/solid/test/solidrouter.test.tsx
@@ -188,7 +188,7 @@
op: 'navigation',
description: '/about',
data: expect.objectContaining({
- [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
+ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solid.solidrouter',
}),
diff --git a/packages/solidstart/test/client/solidrouter.test.tsx b/packages/solidstart/test/client/solidrouter.test.tsx
--- a/packages/solidstart/test/client/solidrouter.test.tsx
+++ b/packages/solidstart/test/client/solidrouter.test.tsx
@@ -188,7 +188,7 @@
op: 'navigation',
description: '/about',
data: expect.objectContaining({
- [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
+ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solidstart.solidrouter',
}),This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
size-limit report 📦
|


This PR adds route parametrization for the solidRouterBrowserTracingIntegration. It replaces raw URLs (e.g. /users/5) with parametrized routes (e.g. /users/:id) in transaction names.
Closes: #16685