diff --git a/src/photo/InfinitePhotoScroll.tsx b/src/photo/InfinitePhotoScroll.tsx index 21fa597b..8a892fda 100644 --- a/src/photo/InfinitePhotoScroll.tsx +++ b/src/photo/InfinitePhotoScroll.tsx @@ -60,7 +60,7 @@ export default function InfinitePhotoScroll({ children: (props: { key: string photos: Photo[] - onLastPhotoVisible: () => void + onLastPhotoVisible?: () => void revalidatePhoto?: RevalidatePhoto }) => ReactNode } & PhotoSetCategory) { @@ -183,7 +183,9 @@ export default function InfinitePhotoScroll({ children({ key: `${cacheKey}-${index}`, photos, - onLastPhotoVisible: advance, + onLastPhotoVisible: index === data.length - 1 + ? advance + : undefined, revalidatePhoto, }) ))}