-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The path of the RouteConfig is the same as the alias content, which will cause an infinite loop. #2461
Closed
chenfengjw163 opened this issue
Nov 1, 2018
· 3 comments
· Fixed by mariazevedo88/hash-generator-js#5, noprotocol/Bubblicious#3, tghelere/valorize-vidas#4, tghelere/DeliVuery#18 or tghelere/dailymages#2
Closed
The path of the RouteConfig is the same as the alias content, which will cause an infinite loop. #2461
chenfengjw163 opened this issue
Nov 1, 2018
· 3 comments
· Fixed by mariazevedo88/hash-generator-js#5, noprotocol/Bubblicious#3, tghelere/valorize-vidas#4, tghelere/DeliVuery#18 or tghelere/dailymages#2
Labels
Comments
PR #2462 if (route.alias !== undefined) {
const aliases = Array.isArray(route.alias)
? route.alias
: [route.alias]
aliases.forEach(alias => {
const aliasRoute = {
path: alias,
children: route.children
}
addRouteRecord(
pathList,
pathMap,
nameMap,
aliasRoute,
parent,
record.path || '/' // matchAs
)
})
}
if (!pathMap[record.path]) {
pathList.push(record.path)
pathMap[record.path] = record
} after: if (!pathMap[record.path]) {
pathList.push(record.path)
pathMap[record.path] = record
}
if (route.alias !== undefined) {
const aliases = Array.isArray(route.alias)
? route.alias
: [route.alias]
aliases.forEach(alias => {
const aliasRoute = {
path: alias,
children: route.children
}
addRouteRecord(
pathList,
pathMap,
nameMap,
aliasRoute,
parent,
record.path || '/' // matchAs
)
})
} |
I think a warning makes more sense here as I don't see a reason to have a path with the same value as an alias |
Yes, but the problem now is that if path and alias are the same, an error will be reported. In #2462 , I have added warning. if (route.alias === path) {
warn(
false,
`Path with the same value as an alias: ` +
`{ path: "${path}" }`
)
} |
This was referenced Aug 29, 2019
This was referenced Sep 30, 2019
This was referenced Oct 26, 2019
This was referenced Jan 20, 2020
This was referenced Feb 5, 2020
This was referenced Mar 4, 2020
This was referenced Mar 24, 2020
This was referenced Apr 15, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
3.0.1
Reproduction link
https://codepen.io/chenfeng163/pen/qJzxGW
Steps to reproduce
The path of the RouteConfig is the same as the alias content
What is expected?
no error
What is actually happening?
infinite loop
The route of alias overrides the route of the path, causing the path and matchAs to be the same. When the url is parsed, an infinite loop occurs.
The text was updated successfully, but these errors were encountered: