From 2c6610cfb8617eefe0c7529007a2617095a49f52 Mon Sep 17 00:00:00 2001 From: Pim Date: Fri, 6 Nov 2020 09:38:08 +0100 Subject: [PATCH] fix(vue-app): triggerScroll when transitions is disabled (#8225) --- packages/vue-app/template/client.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/vue-app/template/client.js b/packages/vue-app/template/client.js index 7647d1cb03..6cc887cf50 100644 --- a/packages/vue-app/template/client.js +++ b/packages/vue-app/template/client.js @@ -650,6 +650,8 @@ function fixPrepatch (to, ___) { const instances = getMatchedComponentsInstances(to) const Components = getMatchedComponents(to) + let triggerScroll = <%= features.transitions ? 'false' : 'true' %> + Vue.nextTick(() => { instances.forEach((instance, i) => { if (!instance || instance._isDestroyed) { @@ -667,12 +669,17 @@ function fixPrepatch (to, ___) { Vue.set(instance.$data, key, newData[key]) } - // Ensure to trigger scroll event after calling scrollBehavior - window.<%= globals.nuxt %>.$nextTick(() => { - window.<%= globals.nuxt %>.$emit('triggerScroll') - }) + triggerScroll = true } }) + + if (triggerScroll) { + // Ensure to trigger scroll event after calling scrollBehavior + window.<%= globals.nuxt %>.$nextTick(() => { + window.<%= globals.nuxt %>.$emit('triggerScroll') + }) + } + checkForErrors(this) <% if (isDev) { %> // Hot reloading