T
TanStack2y ago
conscious-sapphire

Layout segment still reachable route

I have the following url structure: /$id/_layout /$id/_layout/post According to the documentation any segment prefixed with _ is considered to be a layout-route. However, in my application I can still land on /123/layout and the url for /$id/_layout/post is /123/layout/post. Is this the intended way? And if so, is there another way of making sure /$id/layout/ is not a route you can visit and the url for /$id/_layout/post is /123/post?
4 Replies
correct-apricot
correct-apricot2y ago
can you please provide a minimal complete example?
conscious-sapphire
conscious-sapphireOP2y ago
Currently have it running locally, but I'll try and create an example in codesandbox
correct-apricot
correct-apricot2y ago
you can fork one of the existing examples on stackblitz.com
conscious-sapphire
conscious-sapphireOP2y ago
I've tried to replicate it in stackblitz, but couldn't replicate it. I already made sure tsr was using the latest version, nothing Eventually I deleted my entire node_modules folder + lock file and reinstalled everything and it worked for me locally

Did you find this page helpful?