Skip to content

Commit 58c161c

Browse files
authored
Fix flashing of no-src image when using next/image (#18195)
Solves on of the issues in #18122
1 parent 3c6f421 commit 58c161c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/next/client/image.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ function getObserver(): IntersectionObserver | undefined {
6464
if (lazyImage.dataset.srcset) {
6565
lazyImage.srcset = lazyImage.dataset.srcset
6666
}
67+
lazyImage.style.visibility = 'visible'
6768
lazyImage.classList.remove('__lazy')
6869
cachedObserver.unobserve(lazyImage)
6970
}
@@ -251,6 +252,7 @@ export default function Image({
251252
paddingBottom: `${ratio}%`,
252253
}
253254
imgStyle = {
255+
visibility: lazy ? 'hidden' : 'visible',
254256
height: '100%',
255257
left: '0',
256258
position: 'absolute',

0 commit comments

Comments
 (0)