Skip to content

Elaborate more on the route priority order#3374

Merged
MoustaphaDev merged 7 commits intomainfrom
extendend-route-priority-order
Jun 5, 2023
Merged

Elaborate more on the route priority order#3374
MoustaphaDev merged 7 commits intomainfrom
extendend-route-priority-order

Conversation

@MoustaphaDev
Copy link
Member

What kind of changes does this PR include?

  • New or updated content

Description

The current route priority order section lacks some info. For example, endpoints always take precedence in their route category, and prerendered routes always take precedence over server routes. This PR adds more about all that.

@netlify
Copy link

netlify bot commented May 29, 2023

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 4927f64
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/647e1b87649bb000081f931c
😎 Deploy Preview https://deploy-preview-3374--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Comment on lines +236 to +251
1- Routes without path parameters
- Endpoints without path parameters take precedence over all other routes
- Routes without path parameters take precedence over dynamic routes

- Static routes without path parameters will take precedence over all other routes
- Dynamic routes using named parameters take precedence over rest parameters
2- Dynamic routes with path parameters
- Static endpoints using named parameters take precedence over other static routes
- Static routes using named parameters take precedence over server endpoints using named parameters
- Server endpoints using named parameters take precedence over server routes using named parameters
- Server routes using named parameters take precedence over other routes using rest parameters

3- Dynamic routes with rest parameters
- Rest parameters have the lowest priority
- Ties are resolved alphabetically
- Static endpoints using rest parameters take precedence over other static routes using rest parameters
- Static routes using rest parameters take precedence over server endpoints using rest parameters
- Server endpoints using rest parameters take precedence over server routes using rest parameters
- Server routes using rest parameters take precedence over other routes using rest parameters
Copy link
Member Author

@MoustaphaDev MoustaphaDev May 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be a good idea to create a priority queue or a pyramid component to represent these different cases, I feel like this is a bit hard to follow 😅

@sarah11918 sarah11918 added the improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes) label May 29, 2023
@sarah11918
Copy link
Member

Sorry, I'm still not at the stage of really editing this yet, but clarifying question:

This is now a lot more words to read, and I think really all it's saying new is that in every case, endpoints take priority over routes? Maybe we just need a sentence that says that somewhere, and it applies everywhere?

@MoustaphaDev
Copy link
Member Author

Yes that, and also prerendered routes take precedence over server routes in dynamic routes (rest and named).
Going with a sentence is prob simpler, I'll do some edits 😄

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! Thanks for this! 🚀

@MoustaphaDev MoustaphaDev merged commit eb9b734 into main Jun 5, 2023
@MoustaphaDev MoustaphaDev deleted the extendend-route-priority-order branch June 5, 2023 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants