router icon indicating copy to clipboard operation
router copied to clipboard

Numbers in route folder names break the generated routeTree

Open josefbender opened this issue 1 year ago • 1 comments

Which project does this relate to?

Router

Describe the bug

When using numbers in the folder names, the generated routeTree is broken and looks like this

import { Route as rootRoute } from './routes/__root'
import { Route as IndexImport } from './routes/index'
import { Route as R01SimpleQueryIndexImport } fro./routes/01-simple-query/index/index'

Your Example Website or App

https://stackblitz.com/edit/github-pf7werke?file=src%2Froutes%2F01-example%2Findex.tsx

Steps to Reproduce the Bug or Issue

  1. create a folder with numbers in it in the routes folder
  2. create an index.tsx file
  3. get error

Expected behavior

That the generated routeTree is syntatically correct

Screenshots or Videos

Image

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: 134.0.6998.166

Additional context

No response

josefbender avatar Apr 03 '25 10:04 josefbender

You may have been caught in the middle of VSCode interrupting the save of the route-tree file. It's a pretty annoying thing, since VSCode's file watcher interrupts file saves which should be happening in the background, completely transparent to the user.

It's not limits to numbers in the filename. It can randomly happen with normal routes as well. Just to be sure, I've added this as test cases in the router-generator.

That being said, at the moment, there's not much that we can do with how VSCode tries to interrupt these kinds of file saves. I can only recommend adding these settings in the hopes that VSCode respects it.

SeanCassiere avatar Apr 04 '25 01:04 SeanCassiere