Fix adding duplicated routes when users were using router.extendRoutes
#1281
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.
This shouldn't be merged without review for obvious reasons. An explanation for the solution provided in this PR can be found in issue #1280.
The idea here is to check if the route already contains
routesNameSeparator
. In that case it probably means the user already anticipated the lack of support for this and maybe other features and we can (hopefully and) safely skip patching the route object with redundant data.This was adding the same route a couple times so I added a conditional to check if a route with the same name already exists. If that's the case, we only push the new route when it has a
children
property because from what I saw, the module only localizes dynamic children routes in those cases.Works fine on my local enviroment but I'm pretty sure this isn't taking into account all of the cases this module supports. Let me know if you want me to make any changes or add any extra details.
Closes #1280.