Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Add support for pathless layout routes #237

Closed
2 tasks
markostanimirovic opened this issue Jan 31, 2023 · 9 comments · Fixed by #444
Closed
2 tasks

RFC: Add support for pathless layout routes #237

markostanimirovic opened this issue Jan 31, 2023 · 9 comments · Fixed by #444
Assignees
Labels
accepting PRs enhancement New feature or request

Comments

@markostanimirovic
Copy link
Member

markostanimirovic commented Jan 31, 2023

Which scope/s are relevant/related to the feature request?

router

Information

This feature can be useful to group related pages into the same folder without adding additional segments to the URL.

For the following structure:

app
  /routes
    /(auth)
       login.ts
       signup.ts

we'll be able to access the login and signup pages by using /login and /signup URLs. In the same way, we should be able to define a layout/shell component for pages in the (auth) folder:

app
  /routes
    /(auth)
       login.ts
       signup.ts
    (auth).ts

Pathless layout routes in Remix: https://remix.run/docs/en/v1/guides/routing#pathless-layout-routes

Describe any alternatives/workarounds you're currently using

No response

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

  • Yes
  • No
@markostanimirovic markostanimirovic added the enhancement New feature or request label Jan 31, 2023
@brandonroberts
Copy link
Member

I think its a good idea to support this. Was also thinking about supporting a folder that can be co-located in the routes folder but not be picked up as a route, such as _route. I don't think it would conflict with this though

@goetzrobin
Copy link
Member

@brandonroberts I actually ran into this today. I was trying to put components that were only used in a specific route in the same folder as the route. Similar to what you describe or what the Remix docs describe here: https://remix.run/docs/en/v1/file-conventions/route-files-v2#folders-for-organization
I would absolutely this as a new feature!

@goetzrobin
Copy link
Member

@brandonroberts are you planning on creating an RFC for hiding co-located in the routes folders? Or even better, are you already working on adding this feature?

@markostanimirovic
Copy link
Member Author

I updated the issue description - instead of two underscores (/__auth), we can use round brackets /(auth) for consistency because we already support this syntax for pathless routes. Thoughts? 👀

cc @brandonroberts

@brandonroberts
Copy link
Member

@goetzrobin I haven't but I'll create one for the ability to co-locate files within the routes folder. You're welcome to create one also if you already have a use case.

@brandonroberts
Copy link
Member

@markostanimirovic I like it for the consistency. My other thought is it might be confusing if we want to support aux routes in the future that use the parenthesis in the URL.

We could probably define those as /path(outlet-name) with /(path) being used for pathless routes.

@markostanimirovic
Copy link
Member Author

@markostanimirovic I like it for the consistency. My other thought is it might be confusing if we want to support aux routes in the future that use the parenthesis in the URL.

In case we want to support auxiliary routes, it may make sense to do a breaking change and use the __ prefix instead of brackets for all pathless routes.

@brandonroberts
Copy link
Member

@markostanimirovic I like it for the consistency. My other thought is it might be confusing if we want to support aux routes in the future that use the parenthesis in the URL.

In case we want to support auxiliary routes, it may make sense to do a breaking change and use the __ prefix instead of brackets for all pathless routes.

You're saying define pathless routes as __index.ts instead of index.ts or (index.ts)?

I'd prefer to keep those as is and come up with a different convention for aux routes as they are much more niche in terms of usage.

@markostanimirovic
Copy link
Member Author

You're saying define pathless routes as __index.ts instead of index.ts or (index.ts)?

Actually index.ts would remain the same and named pathless routes would change - (home).ts -> __home.ts.

I'd prefer to keep those as is and come up with a different convention for aux routes as they are much more niche in terms of usage.

Agree. 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting PRs enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants