fix!: don't await non-blocking strategies

This commit is contained in:
Daniel Roe 2023-07-28 12:12:03 +02:00
parent 8e18c1bdc0
commit c07db7ee6f

View File

@ -278,7 +278,7 @@ export function useAsyncData<
// Allow directly awaiting on asyncData
const asyncDataPromise = Promise.resolve(nuxt._asyncDataPromises[key]).then(() => asyncData) as AsyncData<ResT, DataE>
Object.assign(asyncDataPromise, asyncData)
Object.assign(options.strategy === 'blocking' ? asyncDataPromise : Promise.resolve(asyncData), asyncData)
return asyncDataPromise as AsyncData<PickFrom<DataT, PickKeys>, DataE>
}