Slow initial load #1929
Send to my agentDescribe the bug#
- At the time of writing,
latestversion is v1.44.0 - The initial load of a skeleton React app using the router is perceivably slow (~500ms from React profiler)
- v1.28.1 is the latest good version (good as in not perceivably slow) which suggests that v1.28.2 introduced a regression
Your Example Website or App#
Steps to Reproduce the Bug or Issue#
- Bad: https://stackblitz.com/edit/tanstack-router-vjwuwc?file=index.html,package.json,package-lock.json,src%2Fmain.tsx,vite.config.js
- Good: https://stackblitz.com/edit/tanstack-router-u6raco?file=index.html,package.json,package-lock.json,src%2Fmain.tsx,vite.config.js
The only difference between Good and Bad is the router version.
- Refresh the page on the StackBlitz browser
- Notice that
This sentence is from Reactloads instantly in the Good version, almost at the same time asThis sentence is from HTML. - Notice that
This sentence is from Reactloads after a delay in the Bad version, ~500ms afterThis sentence is from HTML
Expected behavior#
As a user, I expected no perceivable delays on initial app load
Screenshots or Videos#
No response
Platform#
- macOS
- Chrome Version 126.0.6478.127 (Official Build) (arm64)
Additional context#
No response
Thanks @ericchernuka for the pointer! Sounds like a workaround for now would be to set
defaultPendingMinMsto 0cc #1646
this will be fixed by #1907
reproducer with pre-release package: https://stackblitz.com/edit/tanstack-router-mp74sr?file=index.html,package.json,package-lock.json,src%2Fmain.tsx,vite.config.js
@schiller-manuel I'm still seeing this
500msdelay on1.45.11. SettingdefaultPendingMinMsto0still works as a workaround.Edit: It turned out to not happen when I remove
beforeLoadfrom my routes. These are non-async and only return an object which adds atitleproperty to the router's context so all routes can be joined and set indocument.title. Is it expected thatdefaultPendingMinMsapplies already whenbeforeLoadis set to a non-async method?@levrik can you please open a new issue by and provide a minimal complete example by forking one of the existing router examples on stackblitz? e.g. https://tanstack.com/router/v1/docs/framework/react/examples/quickstart-file-based
Sign in to join this conversation.
Wonder if this is related to https://github.com/TanStack/router/issues/1899