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

Commit dbc0d57

Browse files
committed
Get invites transitioning correctly
1 parent 12fa287 commit dbc0d57

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

src/SlidingSyncManager.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,19 @@ export class SlidingSyncManager {
139139
this.slidingSync.modifyRoomSubscriptions(subscriptions);
140140

141141
return new Promise((resolve, reject) => {
142-
const resolveOnSubscribed = (state, resp, err) => {
143-
if (state === SlidingSyncState.Complete) {
144-
if (visible && !resp.room_subscriptions[roomId]) {
145-
// we want roomId but this /sync response doesn't include it yet.
146-
return;
147-
}
142+
if (this.client.getRoom(roomId)) {
143+
resolve(roomId); // we have data already for this room, show immediately e.g it's in a list
144+
return;
145+
}
146+
const resolveOnSubscribed = (gotRoomId: string) => {
147+
if (roomId === gotRoomId) {
148148
// we processed a /sync response which returned this subscription
149-
this.slidingSync.off(SlidingSyncEvent.Lifecycle, resolveOnSubscribed);
149+
this.slidingSync.off(SlidingSyncEvent.RoomData, resolveOnSubscribed);
150150
resolve(roomId);
151151
}
152152
};
153153
// wait until the next sync before returning as RoomView may need to know the current state
154-
this.slidingSync.on(SlidingSyncEvent.Lifecycle, resolveOnSubscribed);
154+
this.slidingSync.on(SlidingSyncEvent.RoomData, resolveOnSubscribed);
155155
});
156156
}
157157

src/components/structures/RoomView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
394394
}
395395

396396
const roomId = RoomViewStore.getRoomId();
397+
397398
if (initial && SettingsStore.getValue("slidingSync")) {
398399
// set this room as the room subscription. We need to await for it as this will fetch
399400
// all room state for this room, which is required before we get the state below.

src/stores/room-list/RoomListStore.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
154154
*/
155155
private handleRVSUpdate({ trigger = true }) {
156156
if (!this.matrixClient) return; // We assume there won't be RVS updates without a client
157+
if (SettingsStore.getValue("slidingSync")) {
158+
return; // we don't need any of this in sliding sync mode.
159+
}
157160

158161
const activeRoomId = RoomViewStore.getRoomId();
159162
if (!activeRoomId && this.algorithm.stickyRoom) {

0 commit comments

Comments
 (0)