router icon indicating copy to clipboard operation
router copied to clipboard

defaultPendingMs not applying on page load

Open jjonesrs opened this issue 1 year ago • 0 comments

Describe the bug

Version 1.45.2:

  • The pending component appears on hard-load for the entire layout, as documented in https://github.com/TanStack/router/issues/1646.

Versions 1.45.3 - 1.48.1:

  • The pending component no longer appears on hard-load for the layout.
  • However, it still immediately shows on hard-load for the about page component itself, i.e. under the nav.

image

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-hsmnzk?file=src%2Fmain.tsx&preset=node

Steps to Reproduce the Bug or Issue

To make the behavior more noticeable, I made the following adjustments to the forked reproducer:

  • Set defaultPendingMs to 5000ms
  • Left the loader delay at 500ms

Steps:

  1. While on the home page, click the about link. Observe a brief (500ms) delay before the about page loads. The pending component does not show.
  2. While on the about page, click the page reload button. Observe the pending component immediately show for defaultPendingMinMs (5000ms).

Expected behavior

The pending component should only show if the pending state lasts for at least defaultPendingMs. In this reproducer, defaultPendingMs is set to 5000ms and the loader takes 500ms, so the pending component should not show.

Screenshots or Videos

No response

Platform

Any

Additional context

No response

jjonesrs avatar Aug 17 '24 01:08 jjonesrs