mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 14:11:07 +00:00
fix(nuxt): call/transform useAsyncData
and runWithContext
This commit is contained in:
parent
566fa85fc8
commit
1c7fc72493
@ -143,7 +143,7 @@ export function useAsyncData<
|
||||
const promise = new Promise<ResT>(
|
||||
(resolve, reject) => {
|
||||
try {
|
||||
resolve(handler(nuxt))
|
||||
resolve(nuxt.runWithContext(() => handler(nuxt)))
|
||||
} catch (err) {
|
||||
reject(err)
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ export default defineUntypedSchema({
|
||||
* @type {import('unctx').TransformerOptions}
|
||||
*/
|
||||
asyncTransforms: {
|
||||
asyncFunctions: ['defineNuxtPlugin', 'defineNuxtRouteMiddleware'],
|
||||
asyncFunctions: ['defineNuxtPlugin', 'defineNuxtRouteMiddleware', 'runWithContext', 'useAsyncData'],
|
||||
objectDefinitions: {
|
||||
defineNuxtComponent: ['asyncData', 'setup'],
|
||||
defineNuxtPlugin: ['setup'],
|
||||
|
Loading…
Reference in New Issue
Block a user