mirror of https://github.com/vector-im/riot-web
Fix room joining spinner being incorrect if you change room mid-join (#7473)
parent
a4fda7e25d
commit
42d6ff4195
|
@ -144,7 +144,9 @@ class RoomViewStore extends Store<ActionPayload> {
|
||||||
this.joinRoomError(payload);
|
this.joinRoomError(payload);
|
||||||
break;
|
break;
|
||||||
case Action.JoinRoomReady:
|
case Action.JoinRoomReady:
|
||||||
this.setState({ shouldPeek: false });
|
if (this.state.roomId === payload.roomId) {
|
||||||
|
this.setState({ shouldPeek: false });
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'on_client_not_viable':
|
case 'on_client_not_viable':
|
||||||
case 'on_logged_out':
|
case 'on_logged_out':
|
||||||
|
@ -279,7 +281,9 @@ class RoomViewStore extends Store<ActionPayload> {
|
||||||
});
|
});
|
||||||
|
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
const address = this.state.roomAlias || this.state.roomId;
|
// take a copy of roomAlias & roomId as they may change by the time the join is complete
|
||||||
|
const { roomAlias, roomId } = this.state;
|
||||||
|
const address = roomAlias || roomId;
|
||||||
const viaServers = this.state.viaServers || [];
|
const viaServers = this.state.viaServers || [];
|
||||||
try {
|
try {
|
||||||
await retry<any, MatrixError>(() => cli.joinRoom(address, {
|
await retry<any, MatrixError>(() => cli.joinRoom(address, {
|
||||||
|
@ -289,19 +293,19 @@ class RoomViewStore extends Store<ActionPayload> {
|
||||||
// if we received a Gateway timeout then retry
|
// if we received a Gateway timeout then retry
|
||||||
return err.httpStatus === 504;
|
return err.httpStatus === 504;
|
||||||
});
|
});
|
||||||
CountlyAnalytics.instance.trackRoomJoin(startTime, this.state.roomId, payload._type);
|
CountlyAnalytics.instance.trackRoomJoin(startTime, roomId, payload._type);
|
||||||
|
|
||||||
// We do *not* clear the 'joining' flag because the Room object and/or our 'joined' member event may not
|
// We do *not* clear the 'joining' flag because the Room object and/or our 'joined' member event may not
|
||||||
// have come down the sync stream yet, and that's the point at which we'd consider the user joined to the
|
// have come down the sync stream yet, and that's the point at which we'd consider the user joined to the
|
||||||
// room.
|
// room.
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: Action.JoinRoomReady,
|
action: Action.JoinRoomReady,
|
||||||
roomId: this.state.roomId,
|
roomId,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: Action.JoinRoomError,
|
action: Action.JoinRoomError,
|
||||||
roomId: this.state.roomId,
|
roomId,
|
||||||
err: err,
|
err: err,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -354,7 +358,7 @@ class RoomViewStore extends Store<ActionPayload> {
|
||||||
joining: false,
|
joining: false,
|
||||||
joinError: payload.err,
|
joinError: payload.err,
|
||||||
});
|
});
|
||||||
this.showJoinRoomError(payload.err, this.state.roomId);
|
this.showJoinRoomError(payload.err, payload.roomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public reset() {
|
public reset() {
|
||||||
|
|
Loading…
Reference in New Issue