router
router copied to clipboard
defaultPendingComponent causes weird behavior in some cases
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
- go directly to /posts/1
- open the network tab
- tap the close button
- 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