[Glitch] Fix refreshing featured toots when the new collection is empty

Port 1fee4b0fe2 to glitch-soc
lolsob-rspec
Thibaut Girka 2019-06-07 17:05:32 +02:00
parent 00552d2f79
commit 2c240378b2
1 changed files with 3 additions and 1 deletions

View File

@ -35,7 +35,9 @@ 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'));
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;