mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 23:52:06 +00:00
fix(vue-app): handle promise rejection from asyncData
(#18585)
This commit is contained in:
parent
751b784d21
commit
6fa5fc2fa0
@ -317,16 +317,16 @@ const render404Page = () => {
|
|||||||
<% if (features.asyncData) { %>
|
<% if (features.asyncData) { %>
|
||||||
// Call asyncData(context)
|
// Call asyncData(context)
|
||||||
if (Component.options.asyncData && typeof Component.options.asyncData === 'function') {
|
if (Component.options.asyncData && typeof Component.options.asyncData === 'function') {
|
||||||
const promise = promisify(Component.options.asyncData, app.context)
|
const promise = promisify(Component.options.asyncData, app.context)
|
||||||
promise.then((asyncDataResult) => {
|
.then((asyncDataResult) => {
|
||||||
ssrContext.asyncData[Component.cid] = asyncDataResult
|
ssrContext.asyncData[Component.cid] = asyncDataResult
|
||||||
applyAsyncData(Component)
|
applyAsyncData(Component)
|
||||||
return asyncDataResult
|
return asyncDataResult
|
||||||
})
|
})
|
||||||
promises.push(promise)
|
promises.push(promise)
|
||||||
} else {
|
} else {
|
||||||
promises.push(null)
|
promises.push(null)
|
||||||
}
|
}
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if (features.fetch) { %>
|
<% if (features.fetch) { %>
|
||||||
|
Loading…
Reference in New Issue
Block a user