router.startViewTransition leaves the ready/finished promises unhandled, so a skipped transition throws an unhandled AbortError
Maintainers usually reply within 1 day
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
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TanStack/router
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Masked navigation drops the first character of the hash each time (__tempLocation hash missing '#')Possibly taken @hassanabrar202 claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
router-generator: lazy-load Prettier (costs ~300–450ms per build even when formatting is off)Possibly taken @Sheraff claimed this 27 days ago. Openpackage: router-generator performance
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
router-generator: sibling `physical()` subtrees in a virtual route config generate duplicate identifiersPossibly taken @Sheraff claimed this 27 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
docs(router): clarify static title fallback in SPA modePossibly taken @Rohan-Dedhia claimed this 17 days ago. Open
Difficulty 1/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
Similar issues
-
Add: GTrekkerOpencheck:passed streams:add
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area: ui Bug Payload OSS
Difficulty 1/5 Under an hour Newbie friendliness 88/100
payloadcms/payload#19839 ·
Maintainers usually reply within 1 day
-
external
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ClickHouse/ClickStack#3761 ·
Maintainers usually reply within 1 day
-
fix(auth): add the email OTP verification step to Pollar loginPossibly taken @akansnoro claimed this today. OpenStellar Wave
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
safetrustcr/dApp-SafeTrust#584 · 10 comments ·
Maintainers usually reply within 1 day
-
The manager preset saves launch definitions without the required file and digest pairPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day