fix(nuxt): handle undefined when applying defaults for useAsyncData

issue appeared as a regression of #5660
This commit is contained in:
Pooya Parsa 2022-07-07 00:12:31 +02:00
parent 00c1daebaf
commit 8d2f805770

View File

@ -66,7 +66,9 @@ export function useAsyncData<
} }
// Apply defaults // Apply defaults
options = { server: true, default: getDefault, ...options } options.server = options.server ?? true
options.default = options.default ?? getDefault
// TODO: remove support for `defer` in Nuxt 3 RC // TODO: remove support for `defer` in Nuxt 3 RC
if ((options as any).defer) { if ((options as any).defer) {
console.warn('[useAsyncData] `defer` has been renamed to `lazy`. Support for `defer` will be removed in RC.') console.warn('[useAsyncData] `defer` has been renamed to `lazy`. Support for `defer` will be removed in RC.')