Fix Firefox sorting room cards in the wrong direction
Fix https://github.com/matrix-org/matrix-public-archive/issues/218 This stems from the fact that `[1, 2, 3, 4, 5].sort((a, b) => 1)` returns different results in Chrome vs Firefox (found from https://stackoverflow.com/questions/55039157/array-sort-behaves-differently-in-firefox-and-chrome-edge) - Chrome: `[1, 2, 3, 4, 5].sort((a, b) => 1)` -> `[1, 2, 3, 4, 5]` - Firefox: `[1, 2, 3, 4, 5].sort((a, b) => 1)` -> `[ 5, 4, 3, 2, 1 ]`
This commit is contained in:
parent
dfeae90829
commit
b3c8f89d0d
|
@ -88,9 +88,14 @@ class RoomDirectoryViewModel extends ViewModel {
|
|||
);
|
||||
});
|
||||
this._roomCardViewModelsFilterMap = new ApplyMap(this._roomCardViewModelsMap);
|
||||
this._roomCardViewModels = this._roomCardViewModelsFilterMap.sortValues((/*a, b*/) => {
|
||||
// Sort doesn't matter
|
||||
return 1;
|
||||
this._roomCardViewModels = this._roomCardViewModelsFilterMap.sortValues((a, b) => {
|
||||
if (b.numJoinedMembers > a.numJoinedMembers) {
|
||||
return 1;
|
||||
} else if (b.numJoinedMembers < a.numJoinedMembers) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
this._safeSearchEnabled = true;
|
||||
|
|
Loading…
Reference in New Issue