From 330e5c99bc5cf6bb42351e047720f46d313a09e0 Mon Sep 17 00:00:00 2001 From: Thomas Beduneau Date: Mon, 3 May 2021 10:51:18 +0200 Subject: [PATCH] fix(vue-app): use route.replace instead of router.push to trigger navigation guards (#9201) --- packages/vue-app/template/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vue-app/template/index.js b/packages/vue-app/template/index.js index 58c1e231ee..13fdeca493 100644 --- a/packages/vue-app/template/index.js +++ b/packages/vue-app/template/index.js @@ -269,7 +269,7 @@ async function createApp(ssrContext, config = {}) { // Wait for async component to be resolved first await new Promise((resolve, reject) => { - router.push(app.context.route.fullPath, resolve, (err) => { + router.replace(app.context.route.fullPath, resolve, (err) => { // https://github.com/vuejs/vue-router/blob/v3.4.3/src/util/errors.js if (!err._isRouter) return reject(err) if (err.type !== 2 /* NavigationFailureType.redirected */) return resolve()