-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Which project does this relate to?
Router
Describe the bug
When throwing a notFound() in the beforeLoad of a child route, the pendingComponent of a parent route keeps on the foreground. The status of the router remains in "pending".
I think this is probably because the pending components also depend on Suspense which throw promises instead of errors? But that's just a hunch. See the stackblitz for a simple example.
Funny enough I had a more difficult time replicating this issue with the code-based example, but that could be my incompetence.
Your Example Website or App
https://stackblitz.com/edit/tanstack-router-8atqgwzy?file=src%2Froutes%2Fposts.index.tsx
Steps to Reproduce the Bug or Issue
- Open stackblitz
- Go to the "Posts" tab -- a message "I am loading" should appear
- Wait 2 seconds
- notFound is thrown (see console)
- pendingComponent remains while notFound is...nowhere.
I've also tried it with the pathless in the same repo, but there it does seem to work somtimes, even though (or maybe because) it doesn't find the parent's notFoundComponent (is that another bug? or expected?)
Expected behavior
As a user I expect to see the "notFound" component when it's thrown, but I am seeing the "pendingComponent" forever
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.139.14
- OS: macOS
- Browser: any
- Browser Version: any
- Bundler: vite
- Bundler Version: ^7.17
Additional context
Seems related to #2514 which hasn't been touched for a year