Skip to content

Commit

Permalink
feat(warn): improve infinite redirect warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Apr 25, 2023
1 parent fb2bef4 commit 2abecb7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ export function createRouter(options: RouterOptions): Router {
: 1) > 30
) {
warn(
`Detected a possibly infinite redirection in a navigation guard when going from "${from.fullPath}" to "${toLocation.fullPath}". Aborting to avoid a Stack Overflow. This might break in production if not fixed.`
`Detected a possibly infinite redirection in a navigation guard when going from "${from.fullPath}" to "${toLocation.fullPath}". Aborting to avoid a Stack Overflow.\n Are you always returning a new location within a navigation guard? That would lead to this error. Only return when redirecting or aborting, that should fix this. This might break in production if not fixed.`
)
return Promise.reject(
new Error('Infinite redirect in navigation guard')
Expand Down

0 comments on commit 2abecb7

Please sign in to comment.