Skip to content

Commit 6571e9e

Browse files
committed
fix(router): allow duplicated navigation on back + redirect
Fix #1850
1 parent 4e26035 commit 6571e9e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/router/src/router.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ export function createRouter(options: RouterOptions): Router {
978978
const shouldRedirect = handleRedirectRecord(toLocation)
979979
if (shouldRedirect) {
980980
pushWithRedirect(
981-
assign(shouldRedirect, { replace: true }),
981+
assign(shouldRedirect, { replace: true, force: true }),
982982
toLocation
983983
).catch(noop)
984984
return
@@ -1019,7 +1019,9 @@ export function createRouter(options: RouterOptions): Router {
10191019
// the error is already handled by router.push we just want to avoid
10201020
// logging the error
10211021
pushWithRedirect(
1022-
(error as NavigationRedirectError).to,
1022+
assign(locationAsObject((error as NavigationRedirectError).to), {
1023+
force: true,
1024+
}),
10231025
toLocation
10241026
// avoid an uncaught rejection, let push call triggerError
10251027
)

0 commit comments

Comments
 (0)