Skip to content

Commit

Permalink
Fix flashing of no-src image when using next/image (#18195)
Browse files Browse the repository at this point in the history
Solves on of the issues in #18122
  • Loading branch information
timneutkens committed Oct 24, 2020
1 parent 3c6f421 commit 58c161c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/next/client/image.tsx
Expand Up @@ -64,6 +64,7 @@ function getObserver(): IntersectionObserver | undefined {
if (lazyImage.dataset.srcset) {
lazyImage.srcset = lazyImage.dataset.srcset
}
lazyImage.style.visibility = 'visible'
lazyImage.classList.remove('__lazy')
cachedObserver.unobserve(lazyImage)
}
Expand Down Expand Up @@ -251,6 +252,7 @@ export default function Image({
paddingBottom: `${ratio}%`,
}
imgStyle = {
visibility: lazy ? 'hidden' : 'visible',
height: '100%',
left: '0',
position: 'absolute',
Expand Down

0 comments on commit 58c161c

Please sign in to comment.