Skip to content
Source
Sign inSign up
TanStack/router

Aborted loader request renders errorComponent and on rapid param navigation with undefined error #6388

ClosedDima-Kevanishvili(GitHub profile, opens in a new tab) opened this issue 1 comment

Which project does this relate to?

Router

Describe the bug

When rapidly navigating between the same param route with different params, an aborted loader request causes the route’s errorComponent to render because useLoaderData() is undefined. Even though a new loader request is sent and resolves successfully, the route never re-renders and remains stuck in the error state.

This happens during fast navigation and appears to be related to how aborted loader requests are handled.

Your Example Website or App

https://stackblitz.com/edit/vitejs-vite-cwhys51i?file=src%2Fmain.tsx

Steps to Reproduce the Bug or Issue

  1. Start on /
  2. Click Param 1
  3. Quickly click Param 2
  4. Quickly click Param 1 again
  5. Observe error state

Expected behavior

Aborted loader requests should not trigger errorComponent. While a new loader request is in flight, the route should remain pending, and once the latest loader resolves successfully, the route should render normally.

Screenshots or Videos

https://github.com/user-attachments/assets/5e98c3c0-2c38-4a41-ba6f-4c5c3260156c

Platform

  • Router Version: 1.150.0
  • OS: macOS
  • Browser: Chrome
  • Browser Version: 143.0.7499.170 (Official Build) (arm64)
  • Bundler: vite
  • Bundler Version: 7.3.1

Additional context

This is easy to reproduce with: • Slow backend responses • Fast param-based navigation

It looks like an aborted request puts the route into an error state, even though a newer loader request is sent in the background and succeeds.

  1. I think this is a side effect introduced after #4570 . I’ll take a closer look and open a PR to address it.

Sign in to join this conversation.