Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/create-route-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ function addRouteRecord (

if (!pathMap[record.path]) {
pathList.push(record.path)
pathMap[record.path] = record
}
pathMap[record.path] = record
Copy link

@rwaltenberg rwaltenberg Jul 29, 2021

Choose a reason for hiding this comment

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

This is undocumented behavior. The documentation states that only if the route has a name and the name matches with an existing route, it should be overwritten.


if (route.alias !== undefined) {
const aliases = Array.isArray(route.alias) ? route.alias : [route.alias]
Expand Down Expand Up @@ -178,9 +178,8 @@ function addRouteRecord (
}

if (name) {
if (!nameMap[name]) {
nameMap[name] = record
} else if (process.env.NODE_ENV !== 'production' && !matchAs) {
nameMap[name] = record
if (!nameMap[name] && process.env.NODE_ENV !== 'production' && !matchAs) {
warn(
false,
`Duplicate named routes definition: ` +
Expand Down