make equality stable in comparator for reaction
This commit is contained in:
parent
1d9709d4e3
commit
81a721f880
1 changed files with 6 additions and 0 deletions
|
@ -129,6 +129,12 @@ class ReactionViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
_compare(other) {
|
_compare(other) {
|
||||||
|
// the comparator is also used to test for equality, if the comparison returns 0
|
||||||
|
// given that the firstTimestamp isn't set anymore when the last reaction is removed,
|
||||||
|
// the remove event wouldn't be able to find the correct index anymore. So special case equality.
|
||||||
|
if (other === this) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (this.count !== other.count) {
|
if (this.count !== other.count) {
|
||||||
return other.count - this.count;
|
return other.count - this.count;
|
||||||
} else {
|
} else {
|
||||||
|
|
Reference in a new issue