Skip to content

fix(android): [Staged Nav3 Transactions 2] Stage Nav3 transactions requested without the nav lease - #6400

Open
0xadam-brown wants to merge 1 commit into
0xadam-brown/ref/nav3-lease-registrationfrom
0xadam-brown/fix/nav3-deferred-transactions
Open

0xadam-brown wants to merge 1 commit into
0xadam-brown/ref/nav3-lease-registrationfrom
0xadam-brown/fix/nav3-deferred-transactions

Conversation

@0xadam-brown

@0xadam-brown 0xadam-brown commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

PR Stack (Nav3 Deferred Transactions)


📜 Description

A SentryNavEffect that navigates without the nav lease now gets a nav transaction for that destination when its owner next acquires the lease.

See the PR description in #6398 for more details.

💡 Motivation and Context

Fixes missing nav transactions for:

  • ViewPager2 pages: a page that's preloaded offscreen doesn't get the lease until it resumes, so swiping to it produced no transaction.
  • Owners that navigate while covered by another Activity or Fragment (e.g., a delayed push or a result callback) and are then returned to.

addresses: JAVA-785

⚠️ Callouts

Spans created before the staged start (e.g., while a ViewPager2 page is preloaded offscreen) still attach to whichever transaction is bound at that time. This is documented on startNavTransaction().

A real-deal fix likely involves delivering a LocalSentrySpan to the destination composable + finding a way to pick up spans generated outside of the composable. But the problem is pre-existing (and present in a number of manifestations on Nav2), and is a lift too large for the current PR stack.

💚 How did you test it?

  • Unit tests
  • Having my clanker thoroughly test behavior before and after via the Nav3 sample app.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the 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.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

  • sentry-docs: document what ViewPager2 users get (revisits, discarded blocked starts).
  • Possible follow-up: an opt-in transaction on revisit.

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

@sentry

sentry Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.62.0 (1) release

⚙️ sentry-android Build Distribution Settings

@0xadam-brown 0xadam-brown changed the title fix(android): [Nav3 Deferred Transactions 2] Defer Nav3 transactions requested without the nav lease fix(android): [Staged Nav3 Transactions 2] Stage Nav3 transactions requested without the nav lease Oct 27, 2026
@0xadam-brown 0xadam-brown added the sanity-check PR needs a lightweight review for obvious issues label Oct 27, 2026
@0xadam-brown
0xadam-brown marked this pull request as ready for review October 27, 2026 23:20
@0xadam-brown
0xadam-brown requested review from a team and adinauer as code owners October 27, 2026 23:20
A SentryNavEffect that navigates without the nav lease got no nav
transaction for that destination. That covers a preloaded ViewPager2
page that's swiped to, and an owner that navigates while covered by
another Activity or Fragment (e.g., a delayed push or a result callback)
and is then returned to.

Such a request is now staged and starts when the owner next acquires
the lease, with the arguments, view names and nav context recorded in
the meantime. The acquisition is its only chance to start: if another
transaction is bound or the scopes decline it then, it's discarded
rather than kept for a later acquisition. Swiping back to a page whose
transaction has finished still starts none.

The sample tags transactions again on resume, as a page can now get its
transaction without composing.

Refs JAVA-785
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@0xadam-brown
0xadam-brown force-pushed the 0xadam-brown/fix/nav3-deferred-transactions branch from 3841860 to 867786b Compare October 27, 2026 23:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant