From 6571e9ecf0b61c293de24db8261e9d100f308f53 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 6 Feb 2024 21:48:07 +0100 Subject: [PATCH] fix(router): allow duplicated navigation on back + redirect Fix #1850 --- 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 f5cc271ee..e2adb8a78 100644 --- a/packages/router/src/router.ts +++ b/packages/router/src/router.ts @@ -978,7 +978,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 @@ -1019,7 +1019,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 )