Skip to content

Commit

Permalink
fix: provide empty array if source data is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Sep 3, 2022
1 parent db0934c commit 61f636f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/runtime/components/nuxt-picture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 61f636f

Please sign in to comment.