未验证 提交 58c161c9 编写于 作者: T Tim Neutkens 提交者: GitHub

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
上级 3c6f421d
......@@ -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',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册