From 1b5c9dc563d0a2e93b25099115491fd3539a824b Mon Sep 17 00:00:00 2001 From: Shusui MOYATANI Date: Sun, 7 Jan 2024 09:44:39 +0900 Subject: [PATCH] fix: lazy load --- src/components/utils/LazyLoad.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/utils/LazyLoad.tsx b/src/components/utils/LazyLoad.tsx index 034be3a..1480487 100644 --- a/src/components/utils/LazyLoad.tsx +++ b/src/components/utils/LazyLoad.tsx @@ -17,6 +17,7 @@ const LazyLoad: Component = (props) => { entries.forEach((entry) => { if (entry.isIntersecting) { setVisible(true); + observer.disconnect(); } }); }, @@ -34,12 +35,10 @@ const LazyLoad: Component = (props) => { }); return ( -
- - {/* eslint-disable-next-line @typescript-eslint/no-unused-vars */} - {(_) => props.children()} - -
+ {props.fallback}} keyed> + {/* eslint-disable-next-line @typescript-eslint/no-unused-vars */} + {(_) => props.children()} + ); };