kiliman / remix-flat-routes

Remix package to define routes using the flat-routes convention
MIT License
640 stars 22 forks source link

Colocated routes should not include route module filename in route id to match v2 convention #128

Open kiliman opened 1 month ago

kiliman commented 1 month ago

Discussed in https://github.com/kiliman/remix-flat-routes/discussions/126

Originally posted by akomm May 28, 2024 Before I open it in issue, maybe doc confusion again :)

It appears that the route IDs have been altered some. I find frequently a /route suffix at the end of the ID. Its not a frequent thing to use the ID of the routes, but there is one official in remix that is documented, that being useRouteLoaderData(). But there are other use-cases to, I have one and had to adjust code to remove the suffix.

People who use this would have code breakage after adjusting the flat-routes to nested flat-routes because IDs of their routes changed. I have adjusted my code to remove the suffix, but wanted to point out that you might have overlooked it.

akomm commented 1 month ago

I've realized there is more incompatibility:

To maintain the ID also any +/ in the ID needs to be ..

I wonder if all that is even possible considering that the methods can be mixed and not all of them are said to be BC to the current remix v2 system - AFAIK just the nested flat routes?

By possible I mean preserving the ID uniqueness.

kiliman commented 1 month ago

Well, considering the + is a hybrid routing convention, I'm not sure it's a compatibility issue. Perhaps I'll add an option to strip + from route ids.

akomm commented 1 month ago

Oh its part of the hybrid, then nvm.

It was a bit unclear to me that its hybrid, I thought its an extension to the flat-routes

The title confused me, thought its separate from hybrid, but the prompt actually has hybrid in the path name: grafik