You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Throwing notFound() in loader causes infinite "pending" state #1795
If you throw notFound() in a loader after a short delay (e.g. when awaiting a request), the parent routes stay forever stuck in "pending" state.
This behaviour does not happen if the loader promise resolves very quick, e.g. within 100ms.
Simplest reproduction:
exportconstRoute=createFileRoute('/posts/$postId')({loader: async({ params })=>{try{// Simulate a slow request. Resolving this within 100ms works fine, but if it takes longer// the route state will be forever stuck in pending.awaitnewPromise((resolve,reject)=>{setTimeout(()=>{reject();},1000);});}catch(err){// Never showsthrownotFound();}},notFoundComponent: ()=><div>Post not found</div>,});
changed the title [-]Never ending "pending" state when `notFound()` is thrown from a splat route[/-][+]Application stuck in "pending" state when `notFound()` is thrown from a splat route[/+]on Jun 21, 2024
changed the title [-]Application stuck in "pending" state when `notFound()` is thrown from a splat route[/-][+]Application stuck in "pending" state when `notFound()` is thrown from a $param route[/+]on Jun 27, 2024
@tannerlinsley This is currently very broken, where the router gets forever stuck in a pending state when throw notFound() in any async loader or beforeLoad. Latest TSR version (v1.40.0)
Simplest repro (updated Stackblitz):
exportconstRoute=createFileRoute('/posts/$postId')({loader: async({ params })=>{try{// Simulate a slow request. Resolving this within 100ms works fine, but if it takes longer// the route state will be forever stuck in pending.awaitnewPromise((resolve,reject)=>{setTimeout(()=>{reject();},1000);});}catch(err){// Never showsthrownotFound();}},// Expectation: See this component after 1000msnotFoundComponent: ()=><div>Post not found</div>,});
changed the title [-]Application stuck in "pending" state when `notFound()` is thrown from a $param route[/-][+]Throwing `notFound()` in loader causes infinite "pending" state[/+]on Jul 2, 2024
Activity
[-]Never ending "pending" state when `notFound()` is thrown from a splat route[/-][+]Application stuck in "pending" state when `notFound()` is thrown from a splat route[/+][-]Application stuck in "pending" state when `notFound()` is thrown from a splat route[/-][+]Application stuck in "pending" state when `notFound()` is thrown from a $param route[/+]melv-n commentedon Jun 27, 2024
@tannerlinsley This is currently very broken, where the router gets forever stuck in a pending state when
throw notFound()in any asyncloaderorbeforeLoad. Latest TSR version (v1.40.0)Simplest repro (updated Stackblitz):
[-]Application stuck in "pending" state when `notFound()` is thrown from a $param route[/-][+]Throwing `notFound()` in loader causes infinite "pending" state[/+]melv-n commentedon Jul 7, 2024
@schiller-manuel Would be amazing if you could confirm this use-case is also solved by #1907 😍
schiller-manuel commentedon Jul 7, 2024
not solved (yet) unfortunately
fix(router): notfound() now works after longer delay, beforeLoad + no…
tannerlinsley commentedon Jul 8, 2024
This will be fixed in 752a136
schiller-manuel commentedon Jul 8, 2024
reproducer with pre-release package: https://stackblitz.com/edit/tanstack-router-t7vccx?file=src%2Froutes%2Fposts.%24postId.tsx
myeljoud commentedon May 29, 2025
I still have the same issue now
schiller-manuel commentedon May 29, 2025
@myeljoud please create a new GitHub issue including a complete minimal example
natedunn commentedon Dec 9, 2025
I am getting something similar but I can't seem to reproduce. I am very sad and tired. Just in my project. 😞