From f81c588bf62212f4c9db8a803f703fc3a64135aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Thu, 16 Jul 2020 17:10:06 +0200 Subject: [PATCH] fix(vue-app): don't fetch payload for store mutation for preview and spa fallback (#7723) --- packages/vue-app/template/client.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/vue-app/template/client.js b/packages/vue-app/template/client.js index 1d3ba1fd3f..b3f37b9d97 100644 --- a/packages/vue-app/template/client.js +++ b/packages/vue-app/template/client.js @@ -525,10 +525,12 @@ async function render (to, from, next) { <% } %> <% if (isFullStatic && store) { %> - // Replay store mutations, catching to avoid error page on SPA fallback - promises.push(this.fetchPayload(to.path).then(payload => { - payload.mutations.forEach(m => { this.$store.commit(m[0], m[1]) }) - }).catch(err => null)) + if (!this.isPreview && !spaFallback) { + // Replay store mutations, catching to avoid error page on SPA fallback + promises.push(this.fetchPayload(to.path).then(payload => { + payload.mutations.forEach(m => { this.$store.commit(m[0], m[1]) }) + }).catch(err => null)) + } <% } %> // Check disabled page loading