]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
feat(warn): improve infinite redirect warning message
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 25 Apr 2023 13:26:27 +0000 (15:26 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 25 Apr 2023 13:26:27 +0000 (15:26 +0200)
packages/router/src/router.ts

index 575c0bb7b25bca48c109328adff9c56d90b597c8..8493484be83e1066b8358c0dbe2a1299fd718bfa 100644 (file)
@@ -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')