From 61f636fe2285187138bd6310f3dc0d52c8d19dfd Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 3 Sep 2022 22:35:42 +0100 Subject: [PATCH] fix: provide empty array if source data is not present --- src/runtime/components/nuxt-picture.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/runtime/components/nuxt-picture.ts b/src/runtime/components/nuxt-picture.ts index 8b75b678e..218d73f56 100644 --- a/src/runtime/components/nuxt-picture.ts +++ b/src/runtime/components/nuxt-picture.ts @@ -62,11 +62,13 @@ export default defineComponent({ } return () => h('picture', { key: nSources.value[0].src }, [ - ...(nSources.value?.[1] && [h('source', { - type: nSources.value[1].type, - sizes: nSources.value[1].sizes, - srcset: nSources.value[1].srcset - })]), + ...(nSources.value?.[1] + ? [h('source', { + type: nSources.value[1].type, + sizes: nSources.value[1].sizes, + srcset: nSources.value[1].srcset + })] + : []), h('img', { ..._base.attrs.value, ...props.imgAttrs,