#Has <Link to="." ... /> changed recently? I used to be able to update search this way.

9 messages · Page 1 of 1 (latest)

clear void
#

The behavior now routes me to the root "/" layout. I'm able to work around this by grabbing router state by way of useRouterState and dump its respective state's pathname in. Here's an example of the workaround — <MenuItem /> is a lightweight wrapper around <Link/>.

The following used to work with to="."

            <MenuItem
              color="negative"
              iconColor="negative"
              iconName="Logout"
              onClick={handleClosePopover}
              search={(prev) => ({ ...prev, flow: { name: 'signout' } })}
              to={state.location.pathname as LinkProps['to']}
            >
              Sign Out
            </MenuItem>
gray merlin
#

what was the last version that worked with?

#

we did not change it recently

clear void
#

1s, I'll find the version that where it broke..., I think it's been broken in my app for a while 😅

clear void
#

Narrowing things down, pinned my version to 1.81.9 and "to='.'" behaviour works as expected. Pinning router packages to 1.81.10, I start seeing the breakage. Still bisecting versions to isolate what package + version things stop working ...

clear void
#

It feels like a combination of pathless route (e.g. _layout from docs https://tanstack.com/router/v1/docs/framework/react/guide/file-based-routing#pathless-routes) and <Link to=".">. When you don't specify from, it falls back to useMatch({ strict: false, select: (s) => s.pathname }) or the root path. This lines up with the blurb https://tanstack.com/router/latest/docs/framework/react/guide/navigation#everything-is-relative ---> "If a from route ID isn't provided the router will assume you are navigating from the root / route".

I may wrap Link in another component, check if to === '.', and shove the current pathname in as from if that's not passed — feels more natural than using the root path in this case.

gray merlin
#

can you provide a minimal complete example by forking one of the existing stackblitz examples?

clear void
#

I'll take that on 👍 , I ended up passing from={undefined} in my particular case to revert to previous behaviour whenever passing to=".".