Repository navigation
fix(v2): more consistent route config generation - #1946
Merged
Merged
Conversation
Contributor
|
Deploy preview for docusaurus-preview ready! Built with commit ad1b916 |
Contributor
|
Deploy preview for docusaurus-2 ready! Built with commit ad1b916 |
Contributor
|
Deploy preview for docusaurus-preview ready! Built with commit e5302b5 |
Contributor
|
Deploy preview for docusaurus-2 ready! Built with commit e5302b5 |
Contributor
|
Deploy preview for docusaurus-2 ready! Built with commit ea4e87f |
Contributor
|
Deploy preview for docusaurus-preview ready! Built with commit ea4e87f |
yangshun
approved these changes
Nov 8, 2019
mrizwanashiq
pushed a commit
to mrizwanashiq/docusaurus
that referenced
this pull request
Jun 25, 2026
* fix(v2): more consistent route config generation * nits * snapshot * address review & test upd * reduce 2xloop -> 1x loop in docs plugin * nits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Ensure routes config generation to be more consistent in ordering. Nested routes should have params and be placed last in routes.js.
Consider a scenario of having a
src/pages/docs.js. This meansBefore
Component creator will be confused because
/docscan resolve toDocPageandsrc/pages/docs.js. We should be using a:params instead as suggested in https://reacttraining.com/react-router/core/api/Route/route-propsAnother thing is due to async nature of
addRoute, sometimes generated route can be inconsistent and sometimes some nested route takes precedence.We can sort it.
Extra benefit: This will allow user to create

src/pages/docs.jsto create custom docs page for/docs.
Have you read the Contributing Guidelines on pull requests?
yes
Test Plan
src/pages/docs.jsandsrc/pages/docs/super.js. Above route is accessible and not 404.