[Glitch] Fix ID duplication in timelines

Port 306267dbd2 to glitch-soc
remotes/1727458204337373841/tmp_refs/heads/signup-info-prompt
Thibaut Girka 2018-05-27 19:34:08 +02:00 committed by ThibG
parent 4b38ac3bed
commit 15bef77add
1 changed files with 1 additions and 1 deletions

View File

@ -34,7 +34,7 @@ const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial) =>
mMap.update('items', ImmutableList(), oldIds => {
const newIds = statuses.map(status => status.get('id'));
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);
if (firstIndex < 0) {
return (isPartial ? newIds.unshift(null) : newIds).concat(oldIds.skip(lastIndex));