about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-06-05 13:39:59 +0200
committermultiple creatures <dev@multiple-creature.party>2019-11-19 16:32:40 -0600
commit43007ae25fff182547df944dbf9dfa3aad5837f9 (patch)
treecdc30af32efad2e6afac8463288a4f7d47d4dd1b /app
parent61d29f59fbe979d0457d87b72470b2d99e6c241c (diff)
Fix refreshing featured toots when the new collection is empty (#10971)
Fixes #10945
Diffstat (limited to 'app')
-rw-r--r--app/javascript/mastodon/reducers/timelines.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/javascript/mastodon/reducers/timelines.js b/app/javascript/mastodon/reducers/timelines.js
index 6a972f967..309a95a19 100644
--- a/app/javascript/mastodon/reducers/timelines.js
+++ b/app/javascript/mastodon/reducers/timelines.js
@@ -35,14 +35,12 @@ const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial, is
 
     if (!next && !isLoadingRecent) mMap.set('hasMore', false);
 
-    if (!statuses.isEmpty()) {
+    if (timeline.endsWith(':pinned')) {
+      mMap.set('items', statuses.map(status => status.get('id')));
+    } else if (!statuses.isEmpty()) {
       mMap.update('items', ImmutableList(), oldIds => {
         const newIds = statuses.map(status => status.get('id'));
 
-        if (timeline.indexOf(':pinned') !== -1) {
-          return newIds;
-        }
-
         const lastIndex = oldIds.findLastIndex(id => id !== null && compareId(id, newIds.last()) >= 0) + 1;
         const firstIndex = oldIds.take(lastIndex).findLastIndex(id => id !== null && compareId(id, newIds.first()) > 0);