Skip to content

Commit 98f020c

Browse files
cursoragentclaude
andcommitted
fix(solid): Fix navigation span test assertions and numeric delta handling
- Fix test assertions to check for 'url' source instead of 'route' when verifying navigation spans are not created with instrumentNavigation:false. The spanStart event captures spans at creation time when source is 'url', before the createEffect updates it to 'route'. - Fix pendingNavigationTarget guard to handle all numeric navigation deltas (e.g., -2, -3) not just -1. Previously, numeric deltas beyond -1 would block effect updates and prevent route parametrization. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
1 parent bf682c8 commit 98f020c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/solid/src/solidrouter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ function withSentryRouterRoot(Root: Component<RouteSectionProps>): Component<Rou
9191
// transition completes. In that case, location.pathname still points
9292
// to the old route while the active span is already the navigation span.
9393
// Skip the update to avoid overwriting the span with stale route data.
94-
// `-1` is solid router's representation of a browser back-button
95-
// navigation, where we don't know the target URL upfront.
96-
if (pendingNavigationTarget && pendingNavigationTarget !== '-1' && name !== pendingNavigationTarget) {
94+
// Numeric deltas (e.g., `-1`, `-2`) are solid router's representation of
95+
// browser back/forward navigations, where we don't know the target URL upfront.
96+
if (pendingNavigationTarget && !pendingNavigationTarget.match(/^-\d+$/) && name !== pendingNavigationTarget) {
9797
return;
9898
}
9999
pendingNavigationTarget = undefined;

packages/solid/test/solidrouter.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ describe('solidRouterBrowserTracingIntegration', () => {
188188
op: 'navigation',
189189
description: '/about',
190190
data: expect.objectContaining({
191-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
191+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',
192192
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
193193
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solid.solidrouter',
194194
}),

packages/solidstart/test/client/solidrouter.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ describe('solidRouterBrowserTracingIntegration', () => {
188188
op: 'navigation',
189189
description: '/about',
190190
data: expect.objectContaining({
191-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
191+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',
192192
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
193193
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solidstart.solidrouter',
194194
}),

0 commit comments

Comments
 (0)