Skip to content
Source
Sign inSign up
TanStack/router

fix(router-core): handle skipped view transition promises #8802

Openunjica(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8802/headopened

Fixes #8776

🎯 Changes

startViewTransition only returned updateCallbackDone, so when the browser skips a transition (two navigations within ~1 frame) the rejected ready / finished promises were unhandled (AbortError: Transition was skipped).

const transition = document.startViewTransition(params)
transition.ready?.catch(() => {})
transition.finished?.catch(() => {})
return transition.updateCallbackDone

updateCallbackDone is returned unchanged, so update errors still propagate.

Added packages/router-core/tests/view-transition.test.ts (navigation with rejecting ready/finished, missing optional promises, updateCallbackDone identity + rejection). The first test fails without the fix.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with the relevant test commands, or tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

Ran locally: test:unit, test:types, test:eslint, test:build for router-core, react-router, solid-router, vue-router — all pass. The viewTransition e2e tests couldn't launch Chromium in my sandbox, so they were not run.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

AI disclosure: the change and test were drafted with an AI coding agent (Codex) and reviewed before submitting.

Summary by CodeRabbit

  • Bug Fixes
    • Navigation now completes when a view transition is skipped, even if its readiness or completion promises reject.
    • Navigation also succeeds when optional transition promises are unavailable.
    • Rejections from the transition update remain observable to callers.
    1. 🦋 Changeset detected

      Latest commit: e2af57bb0c3db883832a56a9bb5eafe733fbf86e

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 23 packages
      NameType
      @tanstack/router-corePatch
      @tanstack/react-routerPatch
      @tanstack/react-start-clientPatch
      @tanstack/react-start-rscPatch
      @tanstack/react-start-serverPatch
      @tanstack/router-generatorPatch
      @tanstack/router-pluginPatch
      @tanstack/solid-routerPatch
      @tanstack/solid-start-clientPatch
      @tanstack/solid-start-serverPatch
      @tanstack/start-client-corePatch
      @tanstack/start-plugin-corePatch
      @tanstack/start-server-corePatch
      @tanstack/start-storage-contextPatch
      @tanstack/vue-routerPatch
      @tanstack/vue-start-clientPatch
      @tanstack/vue-start-serverPatch
      @tanstack/react-startPatch
      @tanstack/router-cliPatch
      @tanstack/router-vite-pluginPatch
      @tanstack/solid-startPatch
      @tanstack/start-static-server-functionsPatch
      @tanstack/vue-startPatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      📥 Commits

      Reviewing files that changed from the base of the PR and between 6b9fe6d29552270836c511bc9b343d73541f4424 and e2af57bb0c3db883832a56a9bb5eafe733fbf86e.

      📒 Files selected for processing: 3
      • .changeset/cold-ravens-raise.md
      • packages/router-core/src/router.ts
      • packages/router-core/tests/view-transition.test.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

      📝 Walkthrough

      The router now attaches rejection handlers to a view transition’s optional ready and finished promises. It continues to return updateCallbackDone, with tests covering rejected and absent optional promises and observable rejection of the returned promise.

      Changes: View transition promise handling

      Layer / File(s)Summary
      Handle transition promises
      packages/router-core/src/router.ts, packages/router-core/tests/view-transition.test.ts, .changeset/cold-ravens-raise.md
      The router handles rejections from optional ready and finished promises and returns updateCallbackDone. Tests cover navigation when those promises reject or are absent, and verify that rejection of updateCallbackDone remains observable. The changeset records the patch.

      Priority: ➖ Normal

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Suggested reviewers: sheraff

      Merge Risk: ⚪ Minimal · up to e2af5

      No actionable issue remains; the change is ready to merge after normal checks.

      Pre-merge checks: Passed 4 · Failed 1
      Failed Failed checks: 1 warning
      Check nameStatusExplanationResolution
      Docstring CoverageWarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 …Write docstrings for the functions missing them to satisfy the coverage threshold.
      Passed Passed checks: 4 passed
      Check nameStatusExplanation
      Title checkPassedThe title clearly identifies the router-core fix for skipped view transition promises and matches the main change.
      Description checkPassedThe description explains the issue, implementation, tests, release impact, incomplete e2e coverage, and AI authorship. It follows the required template and includes a changeset.
      Linked Issues checkPassedIssue #8776 requires handlers for rejected ready and finished promises from started view transitions. packages/router-core/src/router.ts now attaches no-op handlers to both optional promises and…
      Out of Scope Changes checkPassedThe changes stay within issue #8776. The source change handles skipped transition rejections. The tests verify this behavior and preserve update error behavior. The changeset documents the published f…
      Full details: Linked Issues check

      Explanation

      Issue #8776 requires handlers for rejected ready and finished promises from started view transitions. packages/router-core/src/router.ts now attaches no-op handlers to both optional promises and returns transition.updateCallbackDone unchanged. The added tests cover rejected promises, missing optional promises, and update-promise identity and rejection.

      Full details: Out of Scope Changes check

      Explanation

      The changes stay within issue #8776. The source change handles skipped transition rejections. The tests verify this behavior and preserve update error behavior. The changeset documents the published fix.

      Full details: Docstring Coverage

      Explanation

      Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)

      Resolution

      Write docstrings for the functions missing them to satisfy the coverage threshold.

      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    3. Gentle ping in case this slipped through: the PR is rebased-ready and checks are green. Happy to adjust the approach or add more test coverage if a maintainer would prefer a different fix. Thanks for your time!

Sign in to join this conversation.