mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-18 06:24:25 +01:00
fix: lazy load
This commit is contained in:
@@ -17,6 +17,7 @@ const LazyLoad: Component<LazyLoadProps> = (props) => {
|
|||||||
entries.forEach((entry) => {
|
entries.forEach((entry) => {
|
||||||
if (entry.isIntersecting) {
|
if (entry.isIntersecting) {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
observer.disconnect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -34,12 +35,10 @@ const LazyLoad: Component<LazyLoadProps> = (props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={containerRef}>
|
<Show when={visible()} fallback={<div ref={containerRef}>{props.fallback}</div>} keyed>
|
||||||
<Show when={visible()} fallback={props.fallback} keyed>
|
{/* eslint-disable-next-line @typescript-eslint/no-unused-vars */}
|
||||||
{/* eslint-disable-next-line @typescript-eslint/no-unused-vars */}
|
{(_) => props.children()}
|
||||||
{(_) => props.children()}
|
</Show>
|
||||||
</Show>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user