From 8d2f8057706dcc36db5d805ecd8cb57a010dcd80 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 7 Jul 2022 00:12:31 +0200 Subject: [PATCH] fix(nuxt): handle `undefined` when applying defaults for `useAsyncData` issue appeared as a regression of #5660 --- packages/nuxt/src/app/composables/asyncData.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nuxt/src/app/composables/asyncData.ts b/packages/nuxt/src/app/composables/asyncData.ts index e4ef53c819..98f809429b 100644 --- a/packages/nuxt/src/app/composables/asyncData.ts +++ b/packages/nuxt/src/app/composables/asyncData.ts @@ -66,7 +66,9 @@ export function useAsyncData< } // 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 if ((options as any).defer) { console.warn('[useAsyncData] `defer` has been renamed to `lazy`. Support for `defer` will be removed in RC.')