Skip to content

Commit

Permalink
fix(router): allow duplicated navigation on back + redirect (#2133)
Browse files Browse the repository at this point in the history
  • Loading branch information
posva authored Nov 13, 2024
1 parent 846e287 commit d992bb2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
Expand Down

0 comments on commit d992bb2

Please sign in to comment.