TS errors
This commit is contained in:
parent
c685c8e856
commit
769fd4a786
5 changed files with 46 additions and 30 deletions
|
@ -231,7 +231,7 @@ export class SlidingSyncManager {
|
|||
} catch (err) {
|
||||
logger.debug("ensureListRegistered: update failed txn_id=", err);
|
||||
}
|
||||
return this.slidingSync.getListParams(listKey);
|
||||
return this.slidingSync.getListParams(listKey)!;
|
||||
}
|
||||
|
||||
public async setRoomVisible(roomId: string, visible: boolean): Promise<string> {
|
||||
|
@ -315,13 +315,19 @@ export class SlidingSyncManager {
|
|||
} else {
|
||||
await this.slidingSync.setListRanges(SlidingSyncManager.ListSearch, ranges);
|
||||
}
|
||||
// gradually request more over time
|
||||
await sleep(gapBetweenRequestsMs);
|
||||
} catch (err) {
|
||||
// do nothing, as we reject only when we get interrupted but that's fine as the next
|
||||
// request will include our data
|
||||
} finally {
|
||||
// gradually request more over time, even on errors.
|
||||
await sleep(gapBetweenRequestsMs);
|
||||
}
|
||||
hasMore = endIndex + 1 < this.slidingSync.getListData(SlidingSyncManager.ListSearch)?.joinedCount;
|
||||
const listData = this.slidingSync.getListData(SlidingSyncManager.ListSearch);
|
||||
if (!listData) {
|
||||
// we failed to do the first request, keep trying
|
||||
continue;
|
||||
}
|
||||
hasMore = endIndex + 1 < listData.joinedCount;
|
||||
startIndex += batchSize;
|
||||
firstTime = false;
|
||||
}
|
||||
|
|
|
@ -566,8 +566,8 @@ export default class RoomSublist extends React.Component<IProps, IState> {
|
|||
let isUnreadFirst = RoomListStore.instance.getListOrder(this.props.tagId) === ListAlgorithm.Importance;
|
||||
if (this.slidingSyncMode) {
|
||||
const slidingList = SlidingSyncManager.instance.slidingSync.getListParams(this.props.tagId);
|
||||
isAlphabetical = slidingList.sort[0] === "by_name";
|
||||
isUnreadFirst = slidingList.sort[0] === "by_notification_level";
|
||||
isAlphabetical = (slidingList?.sort || [])[0] === "by_name";
|
||||
isUnreadFirst = (slidingList?.sort || [])[0] === "by_notification_level";
|
||||
}
|
||||
|
||||
// Invites don't get some nonsense options, so only add them if we have to.
|
||||
|
|
|
@ -58,7 +58,7 @@ export const useSlidingSyncRoomSearch = (): {
|
|||
const rooms = [];
|
||||
const { roomIndexToRoomId } = SlidingSyncManager.instance.slidingSync.getListData(
|
||||
SlidingSyncManager.ListSearch,
|
||||
);
|
||||
)!;
|
||||
let i = 0;
|
||||
while (roomIndexToRoomId[i]) {
|
||||
const roomId = roomIndexToRoomId[i];
|
||||
|
|
|
@ -29,6 +29,7 @@ import { MetaSpace, SpaceKey, UPDATE_SELECTED_SPACE } from "../spaces";
|
|||
import { LISTS_LOADING_EVENT } from "./RoomListStore";
|
||||
import { UPDATE_EVENT } from "../AsyncStore";
|
||||
import { SdkContextClass } from "../../contexts/SDKContext";
|
||||
import { filter } from "lodash";
|
||||
|
||||
interface IState {
|
||||
// state is tracked in underlying classes
|
||||
|
@ -84,6 +85,7 @@ export class SlidingRoomListStoreClass extends AsyncStoreWithClient<IState> impl
|
|||
public constructor(dis: MatrixDispatcher, private readonly context: SdkContextClass) {
|
||||
super(dis);
|
||||
this.setMaxListeners(20); // RoomList + LeftPanel + 8xRoomSubList + spares
|
||||
this.stickyRoomId = null;
|
||||
}
|
||||
|
||||
public async setTagSorting(tagId: TagID, sort: SortAlgorithm): Promise<void> {
|
||||
|
@ -249,9 +251,14 @@ export class SlidingRoomListStoreClass extends AsyncStoreWithClient<IState> impl
|
|||
}
|
||||
|
||||
// now set the rooms
|
||||
const rooms = orderedRoomIds.map((roomId) => {
|
||||
return this.matrixClient.getRoom(roomId);
|
||||
});
|
||||
const rooms: Room[] = [];
|
||||
orderedRoomIds.forEach((roomId) => {
|
||||
const room = this.matrixClient.getRoom(roomId);
|
||||
if (!room) {
|
||||
return;
|
||||
}
|
||||
rooms.push(room);
|
||||
})
|
||||
tagMap[tagId] = rooms;
|
||||
this.tagMap = tagMap;
|
||||
}
|
||||
|
@ -352,6 +359,9 @@ export class SlidingRoomListStoreClass extends AsyncStoreWithClient<IState> impl
|
|||
if (roomId === activeSpace) {
|
||||
return;
|
||||
}
|
||||
if (!filters.spaces) {
|
||||
filters.spaces = [];
|
||||
}
|
||||
filters.spaces.push(roomId); // add subspace
|
||||
},
|
||||
false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue