mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +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,
|
_fetchKeyBase: key,
|
||||||
...options,
|
...options,
|
||||||
setup (props, ctx) {
|
setup (props, ctx) {
|
||||||
|
const nuxtApp = useNuxtApp()
|
||||||
const res = setup ? Promise.resolve(setup(props, ctx)).then(r => r || {}) : {}
|
const res = setup ? Promise.resolve(setup(props, ctx)).then(r => r || {}) : {}
|
||||||
const promises: Promise<any>[] = []
|
const promises: Promise<any>[] = []
|
||||||
if (options.asyncData) {
|
if (options.asyncData) {
|
||||||
promises.push(runLegacyAsyncData(res, options.asyncData))
|
promises.push(nuxtApp.runWithContext(() => runLegacyAsyncData(res, options.asyncData)))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.head) {
|
if (options.head) {
|
||||||
|
Loading…
Reference in New Issue
Block a user