mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 00:23:53 +00:00
fix(nuxt): don't override vue instance with legacy asyncData
(#28842)
This commit is contained in:
parent
9c9a93212f
commit
91dfab3f11
@ -16,7 +16,7 @@ async function runLegacyAsyncData (res: Record<string, any> | Promise<Record<str
|
||||
const { fetchKey, _fetchKeyBase } = vm.proxy!.$options
|
||||
const key = (typeof fetchKey === 'function' ? fetchKey(() => '') : fetchKey) ||
|
||||
([_fetchKeyBase, route.fullPath, route.matched.findIndex(r => Object.values(r.components || {}).includes(vm.type))].join(':'))
|
||||
const { data, error } = await useAsyncData(`options:asyncdata:${key}`, () => nuxtApp.runWithContext(() => fn(nuxtApp)))
|
||||
const { data, error } = await useAsyncData(`options:asyncdata:${key}`, () => import.meta.server ? nuxtApp.runWithContext(() => fn(nuxtApp)) : fn(nuxtApp))
|
||||
if (error.value) {
|
||||
throw createError(error.value)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user