]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
fix(router): allow duplicated navigation on back + redirect (#2133)
authorEduardo San Martin Morote <posva@users.noreply.github.com>
Wed, 13 Nov 2024 11:11:16 +0000 (12:11 +0100)
committerGitHub <noreply@github.com>
Wed, 13 Nov 2024 11:11:16 +0000 (12:11 +0100)
packages/router/src/router.ts

index 1906ba452e80a15faa90c73b0731e2be0f6925be..748a06a32a2adbd558ddde432cd3823e650c0df6 100644 (file)
@@ -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
             )