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
I am attempting to do a bit of a specific setup with my routes and I am getting some unexpected behavior.
The high level approach is to have a top level virtual route configuration like this
Those sub sections should be able to do a __virtual.ts file if they desire and federate their routes to sub directories as well
// Folder Hierarchy// src/sub_section/routes/__virtual.ts// src/sub_section/foo/routes/index.ts// example src/sub_section/routes/__virtual.ts import{defineVirtualSubtreeConfig,index,layout,physical,}from"@tanstack/virtual-file-routes";exportdefaultdefineVirtualSubtreeConfig([layout("./_layout.tsx",[physical("/foo","../foo/routes/"),]),]);
The generator wants to generate these routes '/s1/.//_layout/foo/' instead of what I expected '/s1//_layout/foo/'
Not sure if this is expected but it results in the route getting not found in the browser.
Navigating to S2 with the link works correctly (since it uses file base routing not __virtual.ts)
Expected behavior
S1 should resolve as well to the foo/routes/index.tsx
Screenshots or Videos
n/a
Platform
OS: [e.g. macOS, Windows, Linux]
Browser: [e.g. Chrome, Safari, Firefox]
Version: [e.g. 91.1]
Additional context
Benefit / Why do this
It allows splitting routes out by logical sections of your code and having shared layouts for those logical sections.
Debugging / Deep dive
The ./ in the route being added comes from here which then gets added to all the virtual paths here. I am not sure if this is desired to indicate there is a virtual jump there, but the routes don't correctly resolve anymore in the browser due to this.
Other Options / Work around?
Perhaps there is a better or more canonically correct way to accomplish something like this that I am unaware of?
Another approach I tried that did not work is being able to define a __virtual.ts at the root. This did not work either but also seems like it would be beneficial to support for something like this.
The text was updated successfully, but these errors were encountered:
Which project does this relate to?
Router
Describe the bug
I am attempting to do a bit of a specific setup with my routes and I am getting some unexpected behavior.
The high level approach is to have a top level virtual route configuration like this
Those sub sections should be able to do a
__virtual.ts
file if they desire and federate their routes to sub directories as wellThe generator wants to generate these routes
'/s1/.//_layout/foo/' instead of what I expected
'/s1//_layout/foo/'Not sure if this is expected but it results in the route getting not found in the browser.
Your Example Website or App
https://codesandbox.io/p/devbox/rjgqk4?migrateFrom=2jly97
Steps to Reproduce the Bug or Issue
Expected behavior
foo/routes/index.tsx
Screenshots or Videos
n/a
Platform
Additional context
Benefit / Why do this
It allows splitting routes out by logical sections of your code and having shared layouts for those logical sections.
Debugging / Deep dive
The
./
in the route being added comes from here which then gets added to all the virtual paths here. I am not sure if this is desired to indicate there is a virtual jump there, but the routes don't correctly resolve anymore in the browser due to this.Other Options / Work around?
Perhaps there is a better or more canonically correct way to accomplish something like this that I am unaware of?
Another approach I tried that did not work is being able to define a
__virtual.ts
at the root. This did not work either but also seems like it would be beneficial to support for something like this.The text was updated successfully, but these errors were encountered: