Fix Maximum Call Size Stack

This commit is contained in:
Sébastien Chopin 2017-08-29 20:53:50 +02:00
parent db118f1b65
commit b49713a096

View File

@ -11,16 +11,16 @@ if (process.browser) {
}
}
export function applyAsyncData (Component, asyncData = {}) {
export function applyAsyncData (Component, asyncData) {
const ComponentData = Component.options.data || noopData
// Prevent calling this method for each request on SSR context
if(!asyncData && Component.options.hasAsyncData) {
if (!asyncData && Component.options.hasAsyncData) {
return
}
Component.options.hasAsyncData = true
Component.options.data = function () {
const data = ComponentData.call(this)
if(this.$ssrContext) {
if (this.$ssrContext) {
asyncData = this.$ssrContext.asyncData[Component.cid]
}
return { ...data, ...asyncData }