#Is 'overloading' routes possible?

1 messages · Page 1 of 1 (latest)

solemn jolt
#

Hello!

I have an ecommerce remix app that needs to collect some information for order of products. Many of these products will share a few forms, and I would like to be able to dynamically render them from a parameterized route, alongside their normal routes.

Here is how my file structure is set up (still using v1)

allproducts.tsx
products
    - pot
        - depth.tsx
    - pan
        - width.tsx
    - $shared
        - handle.tsx
        - nonstick-type.tsx

I want to share the handle and nonstick-type pages but at a dynamic route while maintaining seo friendly paths.

For example a user should be able to hit /products/pot/handle, but remix first checks if the file exists under the pot folder and throws an error. Is there a way I can get the router to fallback and check if any parameterized routes also match what were looking for and fall back to that?

bold summit
solemn jolt
#

Thanks for that stackblitz, for some reason this same setup doesnt work in my local app. Im going to compare versions and report back

austere meadow
#

There's some cases where during conflicts Remix picks the longer filename (which is usually the most child route), in case that's a possibility here

bold summit
#

I don't think this should be a conflict as for /products/pot/handle only one path matches