From: Eduardo San Martin Morote Date: Tue, 25 Apr 2023 13:26:27 +0000 (+0200) Subject: feat(warn): improve infinite redirect warning message X-Git-Tag: v4.2.0~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2abecb71500e08f11e1686a57110afb71f625433;p=thirdparty%2Fvuejs%2Frouter.git feat(warn): improve infinite redirect warning message --- diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts index 575c0bb7..8493484b 100644 --- a/packages/router/src/router.ts +++ b/packages/router/src/router.ts @@ -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')