fix(vue-app): handle promise rejection from asyncData (#18585)

This commit is contained in:
Rafał Chłodnicki 2023-02-21 11:04:19 +01:00 committed by GitHub
parent 751b784d21
commit 6fa5fc2fa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -317,16 +317,16 @@ const render404Page = () => {
<% if (features.asyncData) { %>
// Call asyncData(context)
if (Component.options.asyncData && typeof Component.options.asyncData === 'function') {
const promise = promisify(Component.options.asyncData, app.context)
promise.then((asyncDataResult) => {
const promise = promisify(Component.options.asyncData, app.context)
.then((asyncDataResult) => {
ssrContext.asyncData[Component.cid] = asyncDataResult
applyAsyncData(Component)
return asyncDataResult
})
promises.push(promise)
} else {
promises.push(null)
}
promises.push(promise)
} else {
promises.push(null)
}
<% } %>
<% if (features.fetch) { %>