Don't peek when creating a room
This causes a race between receiving the room when starting to peek and receiving the room from joining it - https://github.com/vector-im/riot-web/issues/4330, https://github.com/matrix-org/riot-web-rageshakes/issues/196
This commit is contained in:
parent
27f38aeba7
commit
467c195d4f
3 changed files with 17 additions and 5 deletions
|
@ -93,6 +93,7 @@ module.exports = React.createClass({
|
||||||
roomId: null,
|
roomId: null,
|
||||||
roomLoading: true,
|
roomLoading: true,
|
||||||
peekLoading: false,
|
peekLoading: false,
|
||||||
|
shouldPeek: true,
|
||||||
|
|
||||||
// The event to be scrolled to initially
|
// The event to be scrolled to initially
|
||||||
initialEventId: null,
|
initialEventId: null,
|
||||||
|
@ -169,8 +170,13 @@ module.exports = React.createClass({
|
||||||
initialEventPixelOffset: RoomViewStore.getInitialEventPixelOffset(),
|
initialEventPixelOffset: RoomViewStore.getInitialEventPixelOffset(),
|
||||||
isInitialEventHighlighted: RoomViewStore.isInitialEventHighlighted(),
|
isInitialEventHighlighted: RoomViewStore.isInitialEventHighlighted(),
|
||||||
forwardingEvent: RoomViewStore.getForwardingEvent(),
|
forwardingEvent: RoomViewStore.getForwardingEvent(),
|
||||||
|
shouldPeek: RoomViewStore.shouldPeek(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// finished joining, start waiting for a room and show a spinner. See onRoom.
|
||||||
|
newState.waitingForRoom = this.state.joining && !newState.joining &&
|
||||||
|
!RoomViewStore.getJoinError();
|
||||||
|
|
||||||
// Temporary logging to diagnose https://github.com/vector-im/riot-web/issues/4307
|
// Temporary logging to diagnose https://github.com/vector-im/riot-web/issues/4307
|
||||||
console.log(
|
console.log(
|
||||||
'RVS update:',
|
'RVS update:',
|
||||||
|
@ -178,12 +184,11 @@ module.exports = React.createClass({
|
||||||
newState.roomAlias,
|
newState.roomAlias,
|
||||||
'loading?', newState.roomLoading,
|
'loading?', newState.roomLoading,
|
||||||
'joining?', newState.joining,
|
'joining?', newState.joining,
|
||||||
|
'initial?', initial,
|
||||||
|
'waiting?', newState.waitingForRoom,
|
||||||
|
'shouldPeek?', newState.shouldPeek,
|
||||||
);
|
);
|
||||||
|
|
||||||
// finished joining, start waiting for a room and show a spinner. See onRoom.
|
|
||||||
newState.waitingForRoom = this.state.joining && !newState.joining &&
|
|
||||||
!RoomViewStore.getJoinError();
|
|
||||||
|
|
||||||
// NB: This does assume that the roomID will not change for the lifetime of
|
// NB: This does assume that the roomID will not change for the lifetime of
|
||||||
// the RoomView instance
|
// the RoomView instance
|
||||||
if (initial) {
|
if (initial) {
|
||||||
|
@ -239,7 +244,7 @@ module.exports = React.createClass({
|
||||||
if (!this.state.joining && this.state.roomId) {
|
if (!this.state.joining && this.state.roomId) {
|
||||||
if (this.props.autoJoin) {
|
if (this.props.autoJoin) {
|
||||||
this.onJoinButtonClicked();
|
this.onJoinButtonClicked();
|
||||||
} else if (!room) {
|
} else if (!room && this.state.shouldPeek) {
|
||||||
console.log("Attempting to peek into room %s", this.state.roomId);
|
console.log("Attempting to peek into room %s", this.state.roomId);
|
||||||
this.setState({
|
this.setState({
|
||||||
peekLoading: true,
|
peekLoading: true,
|
||||||
|
|
|
@ -100,6 +100,7 @@ function createRoom(opts) {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
room_id: roomId,
|
room_id: roomId,
|
||||||
|
should_peek: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return roomId;
|
return roomId;
|
||||||
|
|
|
@ -137,6 +137,8 @@ class RoomViewStore extends Store {
|
||||||
forwardingEvent: null,
|
forwardingEvent: null,
|
||||||
roomLoading: false,
|
roomLoading: false,
|
||||||
roomLoadError: null,
|
roomLoadError: null,
|
||||||
|
// should peek by default
|
||||||
|
shouldPeek: payload.should_peek === undefined ? true : payload.should_peek,
|
||||||
};
|
};
|
||||||
|
|
||||||
// If an event ID wasn't specified, default to the one saved for this room
|
// If an event ID wasn't specified, default to the one saved for this room
|
||||||
|
@ -297,6 +299,10 @@ class RoomViewStore extends Store {
|
||||||
getForwardingEvent() {
|
getForwardingEvent() {
|
||||||
return this._state.forwardingEvent;
|
return this._state.forwardingEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shouldPeek() {
|
||||||
|
return this._state.shouldPeek;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let singletonRoomViewStore = null;
|
let singletonRoomViewStore = null;
|
||||||
|
|
Loading…
Reference in a new issue