Skip to content

Slow initial load #1929

Closed
Closed

Description

@cheec

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

Activity

  1. ericchernuka commented on Jul 10, 2024

    @ericchernuka

    Wonder if this is related to #1899

  2. cheec commented on Jul 11, 2024

    @cheec
    Author

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

  3. cheec commented on Jul 11, 2024

    @cheec
    Author
  4. schiller-manuel commented on Jul 16, 2024

    @schiller-manuel
    Collaborator
  5. levrik commented on Aug 1, 2024

    @levrik
    Contributor

    @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?

  6. schiller-manuel commented on Aug 1, 2024

    @schiller-manuel
    Collaborator

    @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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions