Ensure that oldest/newest are correct given duplicate timestamps

This commit is contained in:
Scott Nonnenberg 2020-01-31 07:39:30 -08:00 committed by GitHub
parent de630a2ea8
commit 4f16cf595c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -986,10 +986,11 @@ export function reducer(
}
}
if (first && oldest && first.received_at < oldest.received_at) {
// Update oldest and newest if we receive older/newer messages (or duplicated timestamps!)
if (first && oldest && first.received_at <= oldest.received_at) {
oldest = pick(first, ['id', 'received_at']);
}
if (last && newest && last.received_at > newest.received_at) {
if (last && newest && last.received_at >= newest.received_at) {
newest = pick(last, ['id', 'received_at']);
}