Skip to content

Commit

Permalink
fix: prevent hydration mismatch in <NuxtImg> (#1445)
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianGlowala authored Aug 27, 2024
1 parent 62b4387 commit 6d87553
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/components/NuxtImg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:class="props.placeholder && !placeholderLoaded ? props.placeholderClass : undefined"
v-bind="{
...isServer ? { onerror: 'this.setAttribute(\'data-error\', 1)' } : {},
..._attrs,
...imgAttrs,
...attrs,
}"
:src="src"
Expand Down Expand Up @@ -56,7 +56,7 @@ const sizes = computed(() => $img.getSizes(props.src!, {
},
}))
const _attrs = computed(() => {
const imgAttrs = computed(() => {
const attrs: AttrsT = { ..._base.attrs.value, 'data-nuxt-img': '' }
if (!props.placeholder || placeholderLoaded.value) {
Expand Down

0 comments on commit 6d87553

Please sign in to comment.