requestAnimationFrame to initial inf scroll check

This commit is contained in:
Martti Malmi 2023-08-14 11:17:14 +03:00
parent c2f053e769
commit ebaec6fab6

View File

@ -38,7 +38,9 @@ function InfiniteScroll({ children, margin = '2000px', loadMore }: Props) {
}
// Check if the sentinel is within the viewport on mount
checkSentinelInViewport();
requestAnimationFrame(() => {
checkSentinelInViewport();
});
return () => {
if (observerRef.current) {