Skip to content

fix(tracing): Name transaction when re-navigating to focused route with new params - #6606

Merged
antonis merged 7 commits into
mainfrom
fix/6593-same-route-params-navigation
Aug 26, 2026
Merged

antonis merged 7 commits into
mainfrom
fix/6593-same-route-params-navigation

Conversation

@antonis

@antonis antonis commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix

📜 Description

Navigating to the route you're already on with only the params changed — e.g.
navigate('Chat', { id: 2 }) while Chat/id:1 is focused — keeps the same
route.key. The state-change handler treated every same-key change as a
no-op: it dropped its reference to the navigation span without naming or
finalizing it. The idle span then self-finalized and shipped as an unnamed
"Route Change", with a dangling navigation.processing child and an
uncleared route-change timeout.

The same-key branch now distinguishes two cases via a shallow param comparison
(haveRouteParamsChanged):

  • Params unchanged (drawer toggle, empty SET_PARAMS, deep link to the
    current screen) — unchanged: keep the idle-path behaviour.
  • Params changed — fall through to the normal naming/finalization path, so
    the transaction ships named with route.name / route.key /
    route.has_been_seen, ends navigation.processing, and clears the timeout.

The change is confined entirely to the previousRoute.key === route.key
branch; different-key navigation and same-key no-param-change changes are
unaffected.

💡 Motivation and Context

Fixes #6593

💚 How did you test it?

Added unit tests in reactnavigation.test.ts covering a params-changed
re-navigation onto the focused route (ships a named Chat transaction with the
right route attributes, no unnamed "Route Change") and the empty-re-nav case
under default config. Full suite passes (123/123). Existing same-route tests
(drawer / SET_PARAMS / POP_TO / deep-link attribution) remain green.

📝 Checklist

  • I added tests to verify changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • No breaking changes.

🔮 Next steps

…th new params

Navigating to the already-focused route with only params changed keeps the
same route.key. The state-change handler treated this as a no-op and dropped
the navigation span, which then self-finalized as an unnamed "Route Change".
Distinguish same-key/params-changed re-navigation (name and finalize) from a
true no-op same-route change (keep the idle path) via a shallow param compare.

Fixes #6593

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

⚪ None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • fix(tracing): Name transaction when re-navigating to focused route with new params by antonis in #6606
  • chore(deps): update JavaScript SDK to v10.71.0 by github-actions in #6610
  • chore(deps): update Wizard to v7.0.3 by github-actions in #6611
  • fix(ios): Quote script paths so Expo iOS build works with spaces in the project path by antonis in #6604
  • fix(deps): Bump deepmerge-ts to ^8.0.0 (stack-exhaustion advisory) by antonis in #6603
  • fix(android): fragment memory leak in RNSentryReactFragmentLifecycleTracer by minhuwv in #6599
  • chore(deps): bump the codeql-action group with 3 updates by dependabot in #6602
  • chore(deps): update JavaScript SDK to v10.70.0 by github-actions in #6580
  • ci(e2e): remove obsolete CocoaPods sample build job by antonis in #6500
  • chore(deps): update Cocoa SDK to v9.26.0 by github-actions in #6409
  • feat(android): Add NDK app hang tracking options by antonis in #6548
  • chore(deps): bump the codeql-action group with 3 updates by dependabot in #6589
  • chore(deps): bump getsentry/craft from 2.30.0 to 2.30.1 by dependabot in #6591
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.30.0 to 2.30.1 by dependabot in #6590
  • chore(deps): update Sentry Android Gradle Plugin to v6.19.0 by github-actions in #6588
  • chore(deps): update Android SDK to v8.53.0 by github-actions in #6586
  • test(e2e): De-flake TurboModule span-attribute count assertion by antonis in #6596
  • chore(e2e): Bump Android binary size diff limit to 5.8 MiB by antonis in #6595
  • docs: update CONTRIBUTING paths for the monorepo layout by melbinjp in #6594

🤖 This preview updates automatically when you update the PR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@antonis antonis added the ready-to-merge Triggers the full CI test suite label Aug 24, 2026
@sentry

sentry Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.23.0 (103) Release

⚙️ sentry-react-native Build Distribution Settings

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b8b3052. Configure here.

Comment thread packages/core/src/js/tracing/reactnavigation.ts
Comment thread packages/core/test/tracing/reactnavigation.test.ts
@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 439.89 ms 458.15 ms 18.26 ms
Size 49.74 MiB 55.45 MiB 5.71 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
f9c1ed4+dirty 431.00 ms 466.22 ms 35.22 ms
c2e182c+dirty 471.64 ms 553.59 ms 81.95 ms
41d6254+dirty 424.45 ms 474.34 ms 49.89 ms
af33f3b+dirty 434.90 ms 506.14 ms 71.24 ms
882f8ae+dirty 399.98 ms 427.06 ms 27.08 ms
0b5120f+dirty 503.22 ms 538.60 ms 35.38 ms
774257e+dirty 407.09 ms 447.46 ms 40.37 ms
bf168a4+dirty 418.21 ms 489.74 ms 71.53 ms
5569641+dirty 406.43 ms 428.51 ms 22.08 ms
c151573+dirty 530.34 ms 559.43 ms 29.09 ms

App size

Revision Plain With Sentry Diff
f9c1ed4+dirty 49.74 MiB 54.86 MiB 5.12 MiB
c2e182c+dirty 49.74 MiB 54.85 MiB 5.11 MiB
41d6254+dirty 48.30 MiB 53.60 MiB 5.30 MiB
af33f3b+dirty 49.74 MiB 55.09 MiB 5.35 MiB
882f8ae+dirty 48.30 MiB 53.60 MiB 5.29 MiB
0b5120f+dirty 48.30 MiB 53.58 MiB 5.28 MiB
774257e+dirty 48.30 MiB 53.58 MiB 5.28 MiB
bf168a4+dirty 49.74 MiB 55.09 MiB 5.35 MiB
5569641+dirty 48.30 MiB 53.48 MiB 5.18 MiB
c151573+dirty 48.30 MiB 53.54 MiB 5.24 MiB

… test

Address Warden review on #6606:
- The unchanged-params same-key branch now clears the route-change timeout and
  ends the processing span, so a leftover timer cannot later discard the next
  navigation's span.
- Assert the empty default-config re-nav ships no named "Chat" transaction, so
  the intentional empty-back-navigation discard is pinned explicitly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d7615c4. Configure here.

@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3853.71 ms 1208.87 ms -2644.84 ms
Size 5.08 MiB 6.75 MiB 1.67 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
71abba0+dirty 3821.93 ms 1202.81 ms -2619.12 ms
bc0d8cf+dirty 3830.33 ms 1220.52 ms -2609.81 ms
68ae91b+dirty 3834.04 ms 1216.60 ms -2617.44 ms
bf168a4+dirty 3838.60 ms 1218.98 ms -2619.62 ms
267d3ed+dirty 3853.65 ms 1224.70 ms -2628.94 ms
f170ec3+dirty 3822.26 ms 1218.33 ms -2603.93 ms
84cba31+dirty 3846.74 ms 1224.80 ms -2621.93 ms
b9bebee+dirty 3850.15 ms 1227.51 ms -2622.64 ms
d038a14+dirty 3845.71 ms 1228.11 ms -2617.59 ms
853723c+dirty 3852.60 ms 1234.64 ms -2617.96 ms

App size

Revision Plain With Sentry Diff
71abba0+dirty 5.15 MiB 6.67 MiB 1.52 MiB
bc0d8cf+dirty 5.15 MiB 6.67 MiB 1.51 MiB
68ae91b+dirty 4.98 MiB 6.46 MiB 1.48 MiB
bf168a4+dirty 4.98 MiB 6.47 MiB 1.49 MiB
267d3ed+dirty 5.15 MiB 6.69 MiB 1.54 MiB
f170ec3+dirty 5.15 MiB 6.69 MiB 1.53 MiB
84cba31+dirty 4.98 MiB 6.55 MiB 1.57 MiB
b9bebee+dirty 5.15 MiB 6.68 MiB 1.53 MiB
d038a14+dirty 5.15 MiB 6.67 MiB 1.51 MiB
853723c+dirty 5.15 MiB 6.69 MiB 1.53 MiB

@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3839.20 ms 1218.23 ms -2620.97 ms
Size 5.08 MiB 6.75 MiB 1.67 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
7a89652+dirty 3827.11 ms 1211.49 ms -2615.62 ms
0a147b2+dirty 3845.11 ms 1230.81 ms -2614.30 ms
5b7e8a7+dirty 3855.46 ms 1234.47 ms -2620.99 ms
5fe1c6c+dirty 1201.36 ms 1209.15 ms 7.78 ms
95c2f89+dirty 3849.40 ms 1226.85 ms -2622.54 ms
580fb5c+dirty 3835.45 ms 1218.61 ms -2616.84 ms
94af3bd+dirty 3847.84 ms 1230.33 ms -2617.51 ms
f3215d3+dirty 3846.08 ms 1231.85 ms -2614.23 ms
a636fa4+dirty 3846.16 ms 1210.10 ms -2636.05 ms
5a21b51+dirty 3837.87 ms 1223.47 ms -2614.40 ms

App size

Revision Plain With Sentry Diff
7a89652+dirty 5.15 MiB 6.70 MiB 1.55 MiB
0a147b2+dirty 4.98 MiB 6.51 MiB 1.53 MiB
5b7e8a7+dirty 5.15 MiB 6.70 MiB 1.54 MiB
5fe1c6c+dirty 3.38 MiB 4.77 MiB 1.39 MiB
95c2f89+dirty 5.08 MiB 6.75 MiB 1.67 MiB
580fb5c+dirty 4.98 MiB 6.46 MiB 1.48 MiB
94af3bd+dirty 5.15 MiB 6.69 MiB 1.53 MiB
f3215d3+dirty 5.15 MiB 6.67 MiB 1.52 MiB
a636fa4+dirty 4.98 MiB 6.55 MiB 1.57 MiB
5a21b51+dirty 5.15 MiB 6.67 MiB 1.51 MiB

antonis and others added 3 commits August 24, 2026 14:41
…te compare

haveRouteParamsChanged walked only a's keys, so equal-count bags with disjoint
keys whose values are undefined (e.g. { a: undefined } vs { b: undefined })
compared equal. Require each key to exist on b too. Addresses find-bugs review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
oxlint no-unnecessary-type-assertion flagged the casts; b ?? {} already
yields Record<string, unknown>. Bind aBag/bBag via nullish coalescing instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…arams-navigation

# Conflicts:
#	CHANGELOG.md
Comment thread packages/core/test/tracing/reactnavigation.test.ts
Comment thread packages/core/test/tracing/reactnavigation.test.ts
…6593)

Add two cases flagged by review:
- useDispatchedActionData off, same-key changed params: proves the fix names
  the transaction instead of leaking an unnamed "Route Change" (the actual bug
  mode; verified to fail on the pre-fix branch).
- same-key unchanged params: locks the no-op idle path (no route.key/route.name
  attributes set), guarding the timeout-clear + processing-span-end branch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 460.52 ms 519.44 ms 58.92 ms
Size 49.74 MiB 55.45 MiB 5.71 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
7436d0f+dirty 429.58 ms 452.52 ms 22.94 ms
1122a96+dirty 510.16 ms 542.00 ms 31.84 ms
26843eb+dirty 442.02 ms 506.29 ms 64.27 ms
88735e9+dirty 427.04 ms 487.37 ms 60.33 ms
882f8ae+dirty 408.19 ms 435.86 ms 27.67 ms
1a2e7e0+dirty 451.98 ms 501.50 ms 49.52 ms
68672fc+dirty 407.55 ms 442.96 ms 35.41 ms
4966363+dirty 415.67 ms 448.60 ms 32.93 ms
038a6d7+dirty 499.02 ms 527.68 ms 28.66 ms
6176a94+dirty 403.58 ms 446.73 ms 43.15 ms

App size

Revision Plain With Sentry Diff
7436d0f+dirty 48.30 MiB 53.60 MiB 5.30 MiB
1122a96+dirty 48.30 MiB 53.54 MiB 5.24 MiB
26843eb+dirty 49.74 MiB 55.26 MiB 5.52 MiB
88735e9+dirty 49.74 MiB 54.82 MiB 5.07 MiB
882f8ae+dirty 48.30 MiB 53.60 MiB 5.29 MiB
1a2e7e0+dirty 49.74 MiB 54.82 MiB 5.07 MiB
68672fc+dirty 48.30 MiB 53.61 MiB 5.31 MiB
4966363+dirty 48.30 MiB 53.54 MiB 5.24 MiB
038a6d7+dirty 48.30 MiB 53.60 MiB 5.30 MiB
6176a94+dirty 48.30 MiB 53.54 MiB 5.24 MiB

@antonis
antonis marked this pull request as ready for review August 24, 2026 14:57

@antonis antonis left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failed iOS check is investigated in #6609 and is present on main

@antonis antonis removed the ready-to-merge Triggers the full CI test suite label Aug 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor
Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request

Generated by 🚫 dangerJS against d9da00d

// Consume any pending deep link and attach it to this span. Done here
// (after route info is known) so the link is only attributed to a span
// that actually mounted a route — not one that was later discarded.
applyPendingDeepLinkToSpan(latestNavigationSpan, routeChangeTimeoutMs);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doing some extra checks, why we apply applyPendingDeepLinkToSpan here and also on line 724 on the same function? Unrelated to the PR so this can be fixed on a follow up PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll recheck the logic introduced on #6264 and iterate on this. Thank you for raising 🙇

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rechecked this and I think both calls are needed and cover different branches. Line 724 (inside the same-route-key block) is required so a deep link to the current screen tags the span before the POP_TO discard check on 737. In that branch line 799 is never reached. Line 799 is the only call that runs for a normal route change. Let me know if that is not the case 🙇

@lucas-zimerman lucas-zimerman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good! left a comment to an unrelated change. LGTM!

@antonis
antonis merged commit f0619dc into main Aug 26, 2026
90 of 92 checks passed
@antonis
antonis deleted the fix/6593-same-route-params-navigation branch August 26, 2026 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reactNavigationIntegration: a NAVIGATE onto the already-focused route abandons its span, shipping an empty "Route Change" transaction

2 participants