Intent-based loading prevents pendingComponent from showing. #2008
Send to my agentDescribe the bug#
Since #1534 was fixed with #1907, I've found that the pendingComponent will not show if intent-based loading is enabled. The age blocks indefinitely until the dependencies are loaded.
This is better than the behaviour from before the fix, but still leaves something to be desired, and is not the behaviour I'd expect.
Your Example Website or App#
https://stackblitz.com/edit/github-gh73by
In the above, see navigation to the About page, which does not show the specified pending component unless intent-based loading is off.
Steps to Reproduce the Bug or Issue#
Make sure your project has intent-based loading enabled.
- Load into some part of your UI that contains a link with lazy-loaded code behind it.
- Slow down your connection speed using browser throttling tools.
- Hover and immediately click on the link
You will see that you will remain on the current page and no pendingComponent will render, even after the default 1 second wait time. This could be several seconds for slower connections and results in a poor user experience as they wonder "did I really click that link?"
Expected behavior#
I expect the pendingComponent to show after the default 1 second wait time, as it does when preloading is disabled.
Screenshots or Videos#
No response
Platform#
- OS: Windows 11
- Browser: Chrome
- Version: 126
Additional context#
No response
SeanCassiere added labelsbug
I have same issue, it would be nice if I could add some loading indicator, because when user tries to navigate the app feels like frozen.
Ah ... that explains what I've been finding. Same problem.
I tried all of the options like
defaultPreloadStaleTime: 0anddefaultStaleTime: Infinityetc. and whatever I did, my pending component would not show.I faked a delay inloader(), clicked that link ... and nothing happens. It looks frozen. No feedback. Couldn't figure it out.But then I saw this issue and noticed I had
defaultPreload: "intent". Sure enough, removed that ... and the pending component shows.Ah ... that explains what I've been finding. Same problem.
I tried all of the options like
defaultPreloadStaleTime: 0anddefaultStaleTime: Infinityetc. and whatever I did, my pending component would not show.I faked a delay inloader(), clicked that link ... and nothing happens. It looks frozen. No feedback. Couldn't figure it out.But then I saw this issue and noticed I had
defaultPreload: "intent". Sure enough, removed that ... and the pending component shows.@gregmsanderson Can you just give an example here for your solution? Maybe the route config.
@jude98 Ah, I haven't solved it. I just bypassed it.
My pending component was not showing with
defaultPreload: "intent"in my router options. I just commented that line out. That's all I did. With that line commented out, I assume it defaults to not preload. So it is a bug with preload and the solution (for now) seems to be to not preload.
Sign in to join this conversation.
Similar issue here. I have updated to version
^1.47.1. Now when I navigate to a page, it takes few seconds to mount even though the route gets updated, but its not showing any kind of loading states. My router setup is like:I have nested routes
src/routes/~pool/~swap/~$tokenAddress.lazy.tsxfile:src/routes/~pool/~swap/~$tokenAddress.tsxfile:The loading state is only shown when the app first loads.
Any workaround for this?