T
TanStack2y ago
stormy-gold

to option in a layout

Hi ! I use a link in a layout (that means I will never be directly on this route but on its child routes) In this link, I'm using the layout route as from option and using relative path in to option. The problem is that the to relative path is not added to the from path but to the current path. That means If I want to use a Link to "route2" in "/app/route3" it will result in "/app/route3/route3" instead of "/app/route2" in the case where /app is the layout from where the links are. Is this normal or it is a bug ? Thank you.
12 Replies
relaxed-coral
relaxed-coral2y ago
not sure I fully understand, can you please provide a minimal example?
stormy-gold
stormy-goldOP2y ago
Yup. Here is the link https://stackblitz.com/edit/github-jn2jmr?file=src%2Froutes%2Fabout.tsx If you click on About then on Page 1 and then on Page 1, you'll see a not found error cause the url is changed to /about/page1/page1 instead of /about/page1
Maquinours
StackBlitz
Router Quickstart File Based Example - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz
relaxed-coral
relaxed-coral2y ago
i only see Hello /about/page1!
relaxed-coral
relaxed-coral2y ago
No description
relaxed-coral
relaxed-coral2y ago
stormy-gold
stormy-goldOP2y ago
Weird. Could it be due to the browser ?
relaxed-coral
relaxed-coral2y ago
which one are you using? mine is Firefox
stormy-gold
stormy-goldOP2y ago
Tried on Brave. I just tried again and it works as expected in the stackblitz, but does not work in my project. I'm confused
relaxed-coral
relaxed-coral2y ago
are you using the same router version?
stormy-gold
stormy-goldOP2y ago
yep, 1.31.1
relaxed-coral
relaxed-coral2y ago
then you could remove stuff from your application until it works to identify the problem

Did you find this page helpful?