aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/src/components/FeedItems.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/components/FeedItems.tsx')
-rw-r--r--frontend/src/components/FeedItems.tsx9
1 files changed, 8 insertions, 1 deletions
diff --git a/frontend/src/components/FeedItems.tsx b/frontend/src/components/FeedItems.tsx
index a058b70..f43852b 100644
--- a/frontend/src/components/FeedItems.tsx
+++ b/frontend/src/components/FeedItems.tsx
@@ -137,6 +137,13 @@ export default function FeedItems() {
}
scrollToItem(nextIndex);
}
+
+ // If we're now on the last item and there are more items to load,
+ // trigger loading them so the next 'j' press will work
+ if (nextIndex === items.length - 1 && hasMore && !loadingMore) {
+ fetchItems(String(items[items.length - 1]._id));
+ }
+
return nextIndex;
});
} else if (e.key === 'k') {
@@ -159,7 +166,7 @@ export default function FeedItems() {
window.addEventListener('keydown', handleKeyDown);
return () => window.removeEventListener('keydown', handleKeyDown);
- }, [items]);
+ }, [items, hasMore, loadingMore]);