mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 07:05:11 +00:00
fix(nuxt): don't override vue instance with legacy asyncData
(#28842)
This commit is contained in:
parent
74985a5251
commit
468ab2dc0b
@ -16,7 +16,7 @@ async function runLegacyAsyncData (res: Record<string, any> | Promise<Record<str
|
|||||||
const { fetchKey, _fetchKeyBase } = vm.proxy!.$options
|
const { fetchKey, _fetchKeyBase } = vm.proxy!.$options
|
||||||
const key = (typeof fetchKey === 'function' ? fetchKey(() => '') : fetchKey) ||
|
const key = (typeof fetchKey === 'function' ? fetchKey(() => '') : fetchKey) ||
|
||||||
([_fetchKeyBase, route.fullPath, route.matched.findIndex(r => Object.values(r.components || {}).includes(vm.type))].join(':'))
|
([_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) {
|
if (error.value) {
|
||||||
throw createError(error.value)
|
throw createError(error.value)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user