mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 21:25:11 +00:00
fix: wrap legacyasyncdata with runWithCOntext
This commit is contained in:
parent
3161c1545e
commit
2a47785ddd
@ -47,10 +47,11 @@ export const defineNuxtComponent: typeof defineComponent =
|
||||
_fetchKeyBase: key,
|
||||
...options,
|
||||
setup (props, ctx) {
|
||||
const nuxtApp = useNuxtApp()
|
||||
const res = setup ? Promise.resolve(setup(props, ctx)).then(r => r || {}) : {}
|
||||
const promises: Promise<any>[] = []
|
||||
if (options.asyncData) {
|
||||
promises.push(runLegacyAsyncData(res, options.asyncData))
|
||||
promises.push(nuxtApp.runWithContext(() => runLegacyAsyncData(res, options.asyncData)))
|
||||
}
|
||||
|
||||
if (options.head) {
|
||||
|
Loading…
Reference in New Issue
Block a user