You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My naive assumption would be that the only value pathname can ever have here is "/about", but in reality, this will also re-render just before navigating away, with pathname having the value of the next page.
This will show that the console.log(pathname) (similar to the one in the code sample above) logs the next route even though it's only in the route component of /about.
The about.tsx file contains other commented-out methods of "logging the pathname" that demonstrate the various render behaviors.
Expected behavior
I'm not entirely sure what is "expected behavior" here. But my naive intuition would be that for all of these methods, since they're used inside the "/about" route, they should only ever render with the "/about" pathname.
Screenshots or Videos
Screen.Recording.2025-01-04.at.16.43.05.mov
Platform
OS: macOS
Browser: Chrome
Version: 1.95.0
Additional context
This might be the same behavior that causes #2318 because their demo uses
Which project does this relate to?
Router
Describe the bug
Assuming a simple route like this:
My naive assumption would be that the only value
pathname
can ever have here is"/about"
, but in reality, this will also re-render just before navigating away, withpathname
having the value of the next page.Alternatively, we can also use the following:
But in that case,
pathname
will initially have the value of the previous page before immediately re-rendering with the current page.One way to access the
pathname
that seems stable is this:Your Example Website or App
https://stackblitz.com/edit/tanstack-router-fpv611d5?file=src%2Froutes%2F_yo%2Fabout.tsx
Steps to Reproduce the Bug or Issue
This will show that the
console.log(pathname)
(similar to the one in the code sample above) logs the next route even though it's only in the routecomponent
of /about.The
about.tsx
file contains other commented-out methods of "logging the pathname" that demonstrate the various render behaviors.Expected behavior
I'm not entirely sure what is "expected behavior" here. But my naive intuition would be that for all of these methods, since they're used inside the "/about" route, they should only ever render with the "/about" pathname.
Screenshots or Videos
Screen.Recording.2025-01-04.at.16.43.05.mov
Platform
Additional context
This might be the same behavior that causes #2318 because their demo uses
The text was updated successfully, but these errors were encountered: