From d992bb2085cadf01b270e4f04b3d91c4fd5a70e3 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Wed, 13 Nov 2024 12:11:16 +0100 Subject: [PATCH] fix(router): allow duplicated navigation on back + redirect (#2133) --- packages/router/src/router.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts index 1906ba452..748a06a32 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 )