From bcb8d75f71ecd0d5e270d99b84d4c33f309c2e6d Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 23 Apr 2022 16:43:37 -0500 Subject: [PATCH] ScrollableList: don't call onLoadMore() unless it hasMore --- app/soapbox/components/scrollable_list.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/soapbox/components/scrollable_list.tsx b/app/soapbox/components/scrollable_list.tsx index e4dd8a2de..dc64307b5 100644 --- a/app/soapbox/components/scrollable_list.tsx +++ b/app/soapbox/components/scrollable_list.tsx @@ -104,6 +104,12 @@ const ScrollableList: React.FC = ({ } }; + const handleEndReached = () => { + if (hasMore && onLoadMore) { + onLoadMore(); + } + }; + /** Render the actual Virtuoso list */ const renderFeed = (): JSX.Element => ( = ({ className={className} data={data} startReached={onScrollToTop} - endReached={onLoadMore} + endReached={handleEndReached} isScrolling={isScrolling => isScrolling && onScroll && onScroll()} itemContent={renderItem} context={{