Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit aaa9040

Browse files
authored
Merge pull request #6391 from matrix-org/t3chguy/fix/14508.1
2 parents 45e0515 + 05028f1 commit aaa9040

File tree

11 files changed

+136
-164
lines changed

11 files changed

+136
-164
lines changed

src/components/views/rooms/RoomSublist.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,10 @@ export default class RoomSublist extends React.Component<IProps, IState> {
408408
this.setState({ addRoomContextMenuPosition: null });
409409
};
410410

411-
private onUnreadFirstChanged = async () => {
411+
private onUnreadFirstChanged = () => {
412412
const isUnreadFirst = RoomListStore.instance.getListOrder(this.props.tagId) === ListAlgorithm.Importance;
413413
const newAlgorithm = isUnreadFirst ? ListAlgorithm.Natural : ListAlgorithm.Importance;
414-
await RoomListStore.instance.setListOrder(this.props.tagId, newAlgorithm);
414+
RoomListStore.instance.setListOrder(this.props.tagId, newAlgorithm);
415415
this.forceUpdate(); // because if the sublist doesn't have any changes then we will miss the list order change
416416
};
417417

src/stores/room-list/RoomListStore.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
132132
// Update any settings here, as some may have happened before we were logically ready.
133133
console.log("Regenerating room lists: Startup");
134134
await this.readAndCacheSettingsFromStore();
135-
await this.regenerateAllLists({ trigger: false });
136-
await this.handleRVSUpdate({ trigger: false }); // fake an RVS update to adjust sticky room, if needed
135+
this.regenerateAllLists({ trigger: false });
136+
this.handleRVSUpdate({ trigger: false }); // fake an RVS update to adjust sticky room, if needed
137137

138138
this.updateFn.mark(); // we almost certainly want to trigger an update.
139139
this.updateFn.trigger();
@@ -150,31 +150,31 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
150150
await this.updateState({
151151
tagsEnabled,
152152
});
153-
await this.updateAlgorithmInstances();
153+
this.updateAlgorithmInstances();
154154
}
155155

156156
/**
157157
* Handles suspected RoomViewStore changes.
158158
* @param trigger Set to false to prevent a list update from being sent. Should only
159159
* be used if the calling code will manually trigger the update.
160160
*/
161-
private async handleRVSUpdate({ trigger = true }) {
161+
private handleRVSUpdate({ trigger = true }) {
162162
if (!this.matrixClient) return; // We assume there won't be RVS updates without a client
163163

164164
const activeRoomId = RoomViewStore.getRoomId();
165165
if (!activeRoomId && this.algorithm.stickyRoom) {
166-
await this.algorithm.setStickyRoom(null);
166+
this.algorithm.setStickyRoom(null);
167167
} else if (activeRoomId) {
168168
const activeRoom = this.matrixClient.getRoom(activeRoomId);
169169
if (!activeRoom) {
170170
console.warn(`${activeRoomId} is current in RVS but missing from client - clearing sticky room`);
171-
await this.algorithm.setStickyRoom(null);
171+
this.algorithm.setStickyRoom(null);
172172
} else if (activeRoom !== this.algorithm.stickyRoom) {
173173
if (SettingsStore.getValue("advancedRoomListLogging")) {
174174
// TODO: Remove debug: https://github.com/vector-im/element-web/issues/14602
175175
console.log(`Changing sticky room to ${activeRoomId}`);
176176
}
177-
await this.algorithm.setStickyRoom(activeRoom);
177+
this.algorithm.setStickyRoom(activeRoom);
178178
}
179179
}
180180

@@ -226,7 +226,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
226226
console.log("Regenerating room lists: Settings changed");
227227
await this.readAndCacheSettingsFromStore();
228228

229-
await this.regenerateAllLists({ trigger: false }); // regenerate the lists now
229+
this.regenerateAllLists({ trigger: false }); // regenerate the lists now
230230
this.updateFn.trigger();
231231
}
232232
}
@@ -368,7 +368,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
368368
// TODO: Remove debug: https://github.com/vector-im/element-web/issues/14602
369369
console.log(`[RoomListDebug] Clearing sticky room due to room upgrade`);
370370
}
371-
await this.algorithm.setStickyRoom(null);
371+
this.algorithm.setStickyRoom(null);
372372
}
373373

374374
// Note: we hit the algorithm instead of our handleRoomUpdate() function to
@@ -377,7 +377,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
377377
// TODO: Remove debug: https://github.com/vector-im/element-web/issues/14602
378378
console.log(`[RoomListDebug] Removing previous room from room list`);
379379
}
380-
await this.algorithm.handleRoomUpdate(prevRoom, RoomUpdateCause.RoomRemoved);
380+
this.algorithm.handleRoomUpdate(prevRoom, RoomUpdateCause.RoomRemoved);
381381
}
382382
}
383383

@@ -433,7 +433,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
433433
return; // don't do anything on new/moved rooms which ought not to be shown
434434
}
435435

436-
const shouldUpdate = await this.algorithm.handleRoomUpdate(room, cause);
436+
const shouldUpdate = this.algorithm.handleRoomUpdate(room, cause);
437437
if (shouldUpdate) {
438438
if (SettingsStore.getValue("advancedRoomListLogging")) {
439439
// TODO: Remove debug: https://github.com/vector-im/element-web/issues/14602
@@ -462,13 +462,13 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
462462

463463
// Reset the sticky room before resetting the known rooms so the algorithm
464464
// doesn't freak out.
465-
await this.algorithm.setStickyRoom(null);
466-
await this.algorithm.setKnownRooms(rooms);
465+
this.algorithm.setStickyRoom(null);
466+
this.algorithm.setKnownRooms(rooms);
467467

468468
// Set the sticky room back, if needed, now that we have updated the store.
469469
// This will use relative stickyness to the new room set.
470470
if (stickyIsStillPresent) {
471-
await this.algorithm.setStickyRoom(currentSticky);
471+
this.algorithm.setStickyRoom(currentSticky);
472472
}
473473

474474
// Finally, mark an update and resume updates from the algorithm
@@ -477,12 +477,12 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
477477
}
478478

479479
public async setTagSorting(tagId: TagID, sort: SortAlgorithm) {
480-
await this.setAndPersistTagSorting(tagId, sort);
480+
this.setAndPersistTagSorting(tagId, sort);
481481
this.updateFn.trigger();
482482
}
483483

484-
private async setAndPersistTagSorting(tagId: TagID, sort: SortAlgorithm) {
485-
await this.algorithm.setTagSorting(tagId, sort);
484+
private setAndPersistTagSorting(tagId: TagID, sort: SortAlgorithm) {
485+
this.algorithm.setTagSorting(tagId, sort);
486486
// TODO: Per-account? https://github.com/vector-im/element-web/issues/14114
487487
localStorage.setItem(`mx_tagSort_${tagId}`, sort);
488488
}
@@ -520,13 +520,13 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
520520
return tagSort;
521521
}
522522

523-
public async setListOrder(tagId: TagID, order: ListAlgorithm) {
524-
await this.setAndPersistListOrder(tagId, order);
523+
public setListOrder(tagId: TagID, order: ListAlgorithm) {
524+
this.setAndPersistListOrder(tagId, order);
525525
this.updateFn.trigger();
526526
}
527527

528-
private async setAndPersistListOrder(tagId: TagID, order: ListAlgorithm) {
529-
await this.algorithm.setListOrdering(tagId, order);
528+
private setAndPersistListOrder(tagId: TagID, order: ListAlgorithm) {
529+
this.algorithm.setListOrdering(tagId, order);
530530
// TODO: Per-account? https://github.com/vector-im/element-web/issues/14114
531531
localStorage.setItem(`mx_listOrder_${tagId}`, order);
532532
}
@@ -563,7 +563,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
563563
return listOrder;
564564
}
565565

566-
private async updateAlgorithmInstances() {
566+
private updateAlgorithmInstances() {
567567
// We'll require an update, so mark for one. Marking now also prevents the calls
568568
// to setTagSorting and setListOrder from causing triggers.
569569
this.updateFn.mark();
@@ -576,10 +576,10 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
576576
const listOrder = this.calculateListOrder(tag);
577577

578578
if (tagSort !== definedSort) {
579-
await this.setAndPersistTagSorting(tag, tagSort);
579+
this.setAndPersistTagSorting(tag, tagSort);
580580
}
581581
if (listOrder !== definedOrder) {
582-
await this.setAndPersistListOrder(tag, listOrder);
582+
this.setAndPersistListOrder(tag, listOrder);
583583
}
584584
}
585585
}
@@ -632,7 +632,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
632632
* @param trigger Set to false to prevent a list update from being sent. Should only
633633
* be used if the calling code will manually trigger the update.
634634
*/
635-
public async regenerateAllLists({ trigger = true }) {
635+
public regenerateAllLists({ trigger = true }) {
636636
console.warn("Regenerating all room lists");
637637

638638
const rooms = this.getPlausibleRooms();
@@ -656,8 +656,8 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
656656
RoomListLayoutStore.instance.ensureLayoutExists(tagId);
657657
}
658658

659-
await this.algorithm.populateTags(sorts, orders);
660-
await this.algorithm.setKnownRooms(rooms);
659+
this.algorithm.populateTags(sorts, orders);
660+
this.algorithm.setKnownRooms(rooms);
661661

662662
this.initialListsGenerated = true;
663663

0 commit comments

Comments
 (0)