From da45b8b4c9bf00495bb967dda38064ac74b85ead Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Tue, 12 Mar 2019 21:53:56 +0100
Subject: [PATCH] Fix public timeline page not paginating correctly (#10245)

---
 .../features/standalone/public_timeline/index.js       | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/app/javascript/mastodon/features/standalone/public_timeline/index.js b/app/javascript/mastodon/features/standalone/public_timeline/index.js
index 5a67492ac..10129e606 100644
--- a/app/javascript/mastodon/features/standalone/public_timeline/index.js
+++ b/app/javascript/mastodon/features/standalone/public_timeline/index.js
@@ -60,9 +60,13 @@ class PublicTimeline extends React.PureComponent {
     }
   }
 
-  handleLoadMore = maxId => {
-    const { dispatch, local } = this.props;
-    dispatch(local ? expandCommunityTimeline({ maxId }) : expandPublicTimeline({ maxId }));
+  handleLoadMore = () => {
+    const { dispatch, statusIds, local } = this.props;
+    const maxId = statusIds.last();
+
+    if (maxId) {
+      dispatch(local ? expandCommunityTimeline({ maxId }) : expandPublicTimeline({ maxId }));
+    }
   }
 
   setRef = c => {