Closed nakleiderer closed 2 years ago
With remix-flat-routes
you have to explicitly define your index routes.
There's a difference between flat-files
and flat-folders
. With flat-files
the route name is the filename without the extension. With flat-folders
the route name is the folder name, and the index.tsx file is the route file. Either way, you must include index
(or _index
) in the route name to make it an index route.
flat-files
foo.tsx => /foo
foo.index.tsx => /foo/index
flat-folders
foo/index.tsx => /foo
foo.index/index.tsx => /foo/index
When generating routes, flat-routes deviates from Remix's index routing. In Remix,
routes/foo/index.tsx
has a path offoo
, but in flat-routes, it generates a path offoo/
. This can cause form libraries to submit to incorrect routes and lead to other bugs in the app.Input: One file at
routes/foo._index.tsx
Expected:
Actual:
(note the extra "/" character in the Actual vs. Expected)
Repro: https://stackblitz.com/edit/node-bszx6t?file=README.md
Workaround: Renaming
foo._index.tsx
tofoo.tsx
generates the expected routes.