fix(vue-app): don't fetch payload for store mutation for preview and spa fallback (#7723)

This commit is contained in:
Sébastien Chopin 2020-07-16 17:10:06 +02:00 committed by GitHub
parent e537e8c92a
commit f81c588bf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -525,10 +525,12 @@ async function render (to, from, next) {
<% } %> <% } %>
<% if (isFullStatic && store) { %> <% if (isFullStatic && store) { %>
if (!this.isPreview && !spaFallback) {
// Replay store mutations, catching to avoid error page on SPA fallback // Replay store mutations, catching to avoid error page on SPA fallback
promises.push(this.fetchPayload(to.path).then(payload => { promises.push(this.fetchPayload(to.path).then(payload => {
payload.mutations.forEach(m => { this.$store.commit(m[0], m[1]) }) payload.mutations.forEach(m => { this.$store.commit(m[0], m[1]) })
}).catch(err => null)) }).catch(err => null))
}
<% } %> <% } %>
// Check disabled page loading // Check disabled page loading