Skip to content
Source
Sign inSign up
TanStack/router

Slow initial load #1929

Send to my agent
Closedcheec(GitHub profile, opens in a new tab) opened this issue 6 comments

Describe the bug

  • At the time of writing, latest version 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

https://stackblitz.com/edit/tanstack-router-vjwuwc?file=index.html,package.json,package-lock.json,src%2Fmain.tsx,vite.config.js

Steps to Reproduce the Bug or Issue

The only difference between Good and Bad is the router version.

  1. Refresh the page on the StackBlitz browser
  2. Notice that This sentence is from React loads instantly in the Good version, almost at the same time as This sentence is from HTML.
  3. Notice that This sentence is from React loads after a delay in the Bad version, ~500ms after This 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

  1. Thanks @ericchernuka for the pointer! Sounds like a workaround for now would be to set defaultPendingMinMs to 0

  2. @schiller-manuel I'm still seeing this 500ms delay on 1.45.11. Setting defaultPendingMinMs to 0 still works as a workaround.

    Edit: It turned out to not happen when I remove beforeLoad from my routes. These are non-async and only return an object which adds a title property to the router's context so all routes can be joined and set in document.title. Is it expected that defaultPendingMinMs applies already when beforeLoad is set to a non-async method?

  3. @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.