mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
~ fix asyncData parent + children pages in production build (#1248)
This commit is contained in:
parent
04d05de906
commit
16608fad25
@ -171,7 +171,7 @@ export default async context => {
|
|||||||
if (Component.options.asyncData && typeof Component.options.asyncData === 'function') {
|
if (Component.options.asyncData && typeof Component.options.asyncData === 'function') {
|
||||||
let promise = promisify(Component.options.asyncData, ctx)
|
let promise = promisify(Component.options.asyncData, ctx)
|
||||||
promise.then(asyncDataResult => {
|
promise.then(asyncDataResult => {
|
||||||
context.asyncData[Component.options.name] = asyncDataResult
|
context.asyncData[Component.cid] = asyncDataResult
|
||||||
applyAsyncData(Component)
|
applyAsyncData(Component)
|
||||||
return asyncDataResult
|
return asyncDataResult
|
||||||
})
|
})
|
||||||
|
@ -21,7 +21,7 @@ export function applyAsyncData (Component, asyncData = {}) {
|
|||||||
Component.options.data = function () {
|
Component.options.data = function () {
|
||||||
const data = ComponentData.call(this)
|
const data = ComponentData.call(this)
|
||||||
if(this.$ssrContext) {
|
if(this.$ssrContext) {
|
||||||
asyncData = this.$ssrContext.asyncData[Component.options.name]
|
asyncData = this.$ssrContext.asyncData[Component.cid]
|
||||||
}
|
}
|
||||||
return { ...data, ...asyncData }
|
return { ...data, ...asyncData }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user