Skip to content

Commit

Permalink
refactor(addRoute): create route only when parent.alias exists (#3569)
Browse files Browse the repository at this point in the history
* fix(addRoute): create routing only when parent.alias exists

* refactor(addRoute): create route only when parent.alias is not an empty array

if parent.alias is an empty array, there is no need to execute createRouteMap

Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com>

Co-authored-by: wangqiang025 <wangqiang025@ke.com>
Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 16, 2021
1 parent 68ad650 commit 9a0b9fb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/create-matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function createMatcher (
createRouteMap([route || parentOrRoute], pathList, pathMap, nameMap, parent)

// add aliases of parent
if (parent) {
if (parent && parent.alias.length) {
createRouteMap(
// $flow-disable-line route is defined if parent is
parent.alias.map(alias => ({ path: alias, children: [route] })),
Expand Down

0 comments on commit 9a0b9fb

Please sign in to comment.