router icon indicating copy to clipboard operation
router copied to clipboard

Router is stuck in displaying the loading component when an error is thrown from `beforeLoad`

Open cristi-lng opened this issue 1 year ago • 1 comments

Describe the bug

When an error is thrown from the beforeLoad option of a route and the router is configured with pending component, it seems that the router remains stuck in displaying the pending component.

If I remove the pending component it doesn't display anything.

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-g8hajv?file=src%2Fmain.tsx

Steps to Reproduce the Bug or Issue

  1. Check the demo from the link
  2. See how the pending component is displayed indefinitely
  3. You can toggle the defaultPendingComponent to test without the pending mode

Expected behavior

I was expecting to see the error component in both cases: with and without the pending component.

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • @tanstack/react-router: 1.51.0

Additional context

No response

cristi-lng avatar Aug 27 '24 17:08 cristi-lng

Hello, I'm experiencing the same issue.

When using the tanstack devtools, if resolve the promise manually in scripts.loadPromise, it shows the error component. Also, in the status, it is in pending.

Wassim24 avatar Oct 14 '24 15:10 Wassim24