mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-12-28 16:17:10 +00:00
Fix refreshing featured toots when the new collection is empty (#10971)
Fixes #10945
This commit is contained in:
parent
6c464cd424
commit
d34a3a2cc7
|
@ -35,14 +35,12 @@ const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial, is
|
||||||
|
|
||||||
if (!next && !isLoadingRecent) mMap.set('hasMore', false);
|
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 => {
|
mMap.update('items', ImmutableList(), oldIds => {
|
||||||
const newIds = statuses.map(status => status.get('id'));
|
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 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);
|
const firstIndex = oldIds.take(lastIndex).findLastIndex(id => id !== null && compareId(id, newIds.first()) > 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue