Skip to content
Snippets Groups Projects
Commit d34a3a2c authored by ThibG's avatar ThibG Committed by Eugen Rochko
Browse files

Fix refreshing featured toots when the new collection is empty (#10971)

Fixes #10945
parent 6c464cd4
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment