Fix flashing of no-src image when using next/image (#18195)
Solves on of the issues in https://github.com/vercel/next.js/issues/18122
This commit is contained in:
parent
3c6f421d99
commit
58c161c99b
1 changed files with 2 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
@ -251,6 +252,7 @@ export default function Image({
|
|||
paddingBottom: `${ratio}%`,
|
||||
}
|
||||
imgStyle = {
|
||||
visibility: lazy ? 'hidden' : 'visible',
|
||||
height: '100%',
|
||||
left: '0',
|
||||
position: 'absolute',
|
||||
|
|
Loading…
Reference in a new issue