analogjs / analog

The fullstack meta-framework for Angular. Powered by Vite and Nitro
https://analogjs.org
MIT License
2.57k stars 245 forks source link

Router: Route config for named nested routes is not generated correctly #273

Closed markostanimirovic closed 1 year ago

markostanimirovic commented 1 year ago

Which area/package is the issue in?

router

Description

If the routes directory has the following structure:

/routes
  /users
    create.ts

Navigation to /users/create will not work. As a workaround, we can use 'dot' notation:

/routes
  users.create.ts

I would be willing to submit a PR to fix this issue

brandonroberts commented 1 year ago

Thanks @markostanimirovic. I think this should be supported also.

This was also brought up in the Analog Discord

yassernasc commented 1 year ago

Hello, I am having trouble creating a route with the scheme: route.[route-id].subroute.[subroute-id].ts and I think Analog wasn't designed to handle such a complex scenario. Is my problem related to this github issue?

brandonroberts commented 1 year ago

@yassernasc that should be supported, but its a separate issue. Its a bug in the replacement for the paths

https://github.com/analogjs/analog/blob/main/packages/router/src/lib/routes.ts#L51

Only the first period is being replaced.

yassernasc commented 1 year ago

I see, thank you for pointing out the exact location to debug.