make alphabetical sort order stable

This commit is contained in:
Bruno Windels 2020-08-17 10:47:27 +02:00
parent 989a27395e
commit 404e6f8b87

View File

@ -45,8 +45,12 @@ export class RoomTileViewModel extends ViewModel {
}
compare(other) {
// sort by name for now
return this._room.name.localeCompare(other._room.name);
// sort alphabetically
const nameCmp = this._room.name.localeCompare(other._room.name);
if (nameCmp === 0) {
return this._room.id.localeCompare(other._room.id);
}
return nameCmp;
}
get isOpen() {