mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 18:52:19 +00:00
[fix] Improve lazy loading logic in LazyImage component
This commit is contained in:
@@ -64,9 +64,7 @@ useIntersectionObserver(
|
|||||||
containerRef,
|
containerRef,
|
||||||
(entries) => {
|
(entries) => {
|
||||||
const entry = entries[0]
|
const entry = entries[0]
|
||||||
if (entry?.isIntersecting) {
|
isIntersecting.value = entry?.isIntersecting ?? false
|
||||||
isIntersecting.value = true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rootMargin,
|
rootMargin,
|
||||||
@@ -96,6 +94,11 @@ watch(
|
|||||||
// Fallback to original src
|
// Fallback to original src
|
||||||
cachedSrc.value = src
|
cachedSrc.value = src
|
||||||
}
|
}
|
||||||
|
} else if (!shouldLoad) {
|
||||||
|
// Hide image when out of view
|
||||||
|
isImageLoaded.value = false
|
||||||
|
cachedSrc.value = undefined
|
||||||
|
hasError.value = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
|
|||||||
Reference in New Issue
Block a user