router icon indicating copy to clipboard operation
router copied to clipboard

defaultPendingComponent causes weird behavior in some cases

Open TommysG opened this issue 1 year ago • 0 comments

Describe the bug

I have a weird bug. I have two routes that the first is the posts list and the second is /posts/$postId. $postId is the child of /posts route.

When going DIRECTLY within the URL for example /posts/4 and press the X button to close the sheet i see in the network tab that refetches data for this route, like the component remounts on close.

After hours of debugging i found out that defaultPendingComponent causes this...

Your Example Website or App

https://stackblitz.com/~/edit/github-844nb4?file=src%2Fmain.tsx&view=editor

Steps to Reproduce the Bug or Issue

  1. go directly to /posts/1
  2. open the network tab
  3. tap the close button
  4. watch that the componet is mounts again before closing

Expected behavior

I expected to work like when defaultPendingComponent is not declared and not re-mount my component before closing.

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • @tanstack/react-router: 1.15.15

Additional context

No response

TommysG avatar Feb 03 '24 15:02 TommysG