Hot reload breaks routes imported with aliases #4303
Send to my agentWhich project does this relate to?#
Router
Describe the bug#
After hot reloading a file, Route properties such as to, id, and path are not present on route objects that were imported using an alias in that file or in files associated with child routes.
Your Example Website or App#
https://stackblitz.com/edit/tanstack-router-ngfewadv?file=src%2Fcomponents%2FLayoutLink.jsx
Steps to Reproduce the Bug or Issue#
- Click "Pathless Layout", "Show child route A", and "Navigate back to parent route A" to demonstrate working navigation.
- Click "Show child route A", make an arbitrary change to LayoutLink.jsx and save.
- Click "Navigate back to parent route A". No navigation occurs.
- Click "Go to route B" and "Show child route B" to demonstrate working navigation in parent components.
- Click "Go to route C", make an arbitrary change to LayoutComponent.jsx and save.
- Click "Show child route C". No navigation occurs.
- Click "Navigate from route C to home". Navigation works as expected.
- Make an arbitrary change to HomeLink.jsx, save, and click "Pathless Layout" then "Navigate from route A to home". Navigation works as expected.
Expected behavior#
I expected all links to continue to work after any hot reload regardless of import alias. However, when a file containing a component used in the route tree imports a route object using an alias, the aliased import will not work properly after hot reloading the file. Aliased route imports in components further down the route tree will also break. Aliased route imports in child components which are not part of the route tree will continue to work as expected.
Screenshots or Videos#
No response
Platform#
- OS: Windows 11
- Browser: Firefox
- Version: 138.0.4
Additional context#
No response
Sign in to join this conversation.