fix(nuxt): use callAsync for executing hooks with context (#20510)

This commit is contained in:
Daniel Roe 2023-04-26 07:15:22 +01:00 committed by GitHub
parent 9170a721f7
commit 7ab476b1f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -221,7 +221,7 @@ export function createNuxtApp (options: CreateOptions) {
if (process.server) {
async function contextCaller (hooks: HookCallback[], args: any[]) {
for (const hook of hooks) {
await nuxtAppCtx.call(nuxtApp, () => hook(...args))
await nuxtAppCtx.callAsync(nuxtApp, () => hook(...args))
}
}
// Patch callHook to preserve NuxtApp context on server