router.startViewTransition leaves the ready/finished promises unhandled, so a skipped transition throws an unhandled AbortError

Open Beginner friendly
#8,776 3 comments 2 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@unjica is already working on this.

Since Oct 23, 2026.

  • #8802 by @unjica — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
frontend

Research direction

Start in router-core/src/router.ts at router.startViewTransition, where document.startViewTransition(fn) is called and updateCallbackDone is used. Reproduce the unhandled rejection with the two consecutive navigations in the issue, then check how the transition's ready and finished promises are handled. Done when skipped transitions no longer cause an unhandled rejection.

Written by the indexing model from the issue text.

Description

Describe the bug

With defaultViewTransition: true, router.startViewTransition (router-core/src/router.ts) calls
document.startViewTransition(fn).updateCallbackDone and drops the ViewTransition object.
Its ready and finished promises get no handler.

updateCallbackDone settles when the DOM update is done, well before the animation ends. So any
navigation that starts while the previous cross-fade is still animating skips that transition,
the browser rejects its ready with AbortError: Transition was skipped. New ViewTransition started,
and nothing handles the rejection. await router.navigate() does not prevent it, because it
resolves on updateCallbackDone.

In an app this is console noise on quick consecutive navigations. In a test runner
(vitest browser mode) it fails the whole run: every test passes, then vitest reports
"Unhandled Rejection" and exits non-zero.

Reproduction

Vitest browser mode (chromium), no UI needed:

import { createMemoryHistory, createRootRoute, createRoute, createRouter } from '@tanstack/react-router'
import { test } from 'vitest'

test('two navigations in a row', async () => {
  const root = createRootRoute()
  const a = createRoute({ getParentRoute: () => root, path: '/a' })
  const b = createRoute({ getParentRoute: () => root, path: '/b' })
  const router = createRouter({
    routeTree: root.addChildren([a, b]),
    history: createMemoryHistory({ initialEntries: ['/a'] }),
    defaultViewTransition: true,
  })
  await router.load()
  await router.navigate({ to: '/b' })
  await router.navigate({ to: '/a' })
})

Result: the test passes, then Unhandled Rejection: AbortError: Transition was skipped. New ViewTransition started and a failing exit code.

Expected behavior

A skipped transition is not an error for the app. The router should attach a no-op handler to
ready and finished of the transition it starts.

Verified

Wrapping document.startViewTransition so the returned object gets
t.ready.catch(() => {}) and t.finished.catch(() => {}) removes the error completely
(0 errors in the same repro).

Versions

@tanstack/react-router 1.170.45, @tanstack/router-core 1.171.38, Chromium (vitest browser mode)

Dominant language
TypeScript
Stars
15.3k
Forks
1.9k
Avg merge
1d 5h
Merged PRs (30d)
46

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TanStack/router

All issues in TanStack/router

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.