From e51c4ff1b1c426d24d2238e388568f8af3405f32 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Tue, 22 Feb 2022 20:41:16 -0800 Subject: [PATCH] check item load count before loading more items --- .../Sources/Views/PrimaryContainerViews/HomeFeedView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apple/OmnivoreKit/Sources/Views/PrimaryContainerViews/HomeFeedView.swift b/apple/OmnivoreKit/Sources/Views/PrimaryContainerViews/HomeFeedView.swift index 7da78856b..efe6c268d 100644 --- a/apple/OmnivoreKit/Sources/Views/PrimaryContainerViews/HomeFeedView.swift +++ b/apple/OmnivoreKit/Sources/Views/PrimaryContainerViews/HomeFeedView.swift @@ -39,7 +39,7 @@ public final class HomeFeedViewModel: ObservableObject { let thresholdIndex = items.index(items.endIndex, offsetBy: -5) // Check if user has scrolled to the last five items in the list - if itemIndex == thresholdIndex { + if itemIndex == thresholdIndex, items.count < thresholdIndex + 10 { performActionSubject.send(.loadItems(query: searchQuery)) } }