Skip to content

Commit

Permalink
fix(router): allow duplicated navigation on back + redirect
Browse files Browse the repository at this point in the history
Fix #1850
  • Loading branch information
posva committed Feb 6, 2024
1 parent 4e26035 commit 6571e9e
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 @@ -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
Expand Down Expand Up @@ -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
)
Expand Down

0 comments on commit 6571e9e

Please sign in to comment.