mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-24 20:14:53 +01:00
make equality stable in comparator for reaction
This commit is contained in:
parent
1d9709d4e3
commit
81a721f880
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user