From: Eduardo San Martin Morote Date: Wed, 13 Nov 2024 11:11:16 +0000 (+0100) Subject: fix(router): allow duplicated navigation on back + redirect (#2133) X-Git-Tag: v4.5.0~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d992bb2085cadf01b270e4f04b3d91c4fd5a70e3;p=thirdparty%2Fvuejs%2Frouter.git fix(router): allow duplicated navigation on back + redirect (#2133) --- diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts index 1906ba45..748a06a3 100644 --- a/packages/router/src/router.ts +++ b/packages/router/src/router.ts @@ -1022,7 +1022,7 @@ export function createRouter(options: RouterOptions): Router { const shouldRedirect = handleRedirectRecord(toLocation) if (shouldRedirect) { pushWithRedirect( - assign(shouldRedirect, { replace: true }), + assign(shouldRedirect, { replace: true, force: true }), toLocation ).catch(noop) return @@ -1063,7 +1063,9 @@ export function createRouter(options: RouterOptions): Router { // the error is already handled by router.push we just want to avoid // logging the error pushWithRedirect( - (error as NavigationRedirectError).to, + assign(locationAsObject((error as NavigationRedirectError).to), { + force: true, + }), toLocation // avoid an uncaught rejection, let push call triggerError )