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

Commit 8840625

Browse files
authored
Merge pull request #1097 from matrix-org/luke/attempt-fix-peeking-regression
Luke/attempt fix peeking regression
2 parents 9e3efb5 + 58554cc commit 8840625

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/components/structures/RoomView.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,21 @@ module.exports = React.createClass({
170170
isInitialEventHighlighted: RoomViewStore.isInitialEventHighlighted(),
171171
};
172172

173+
// Temporary logging to diagnose https://github.com/vector-im/riot-web/issues/4307
174+
console.log(
175+
'RVS update:',
176+
newState.roomId,
177+
newState.roomAlias,
178+
'loading?', newState.roomLoading,
179+
'joining?', newState.joining,
180+
);
181+
182+
// NB: This does assume that the roomID will not change for the lifetime of
183+
// the RoomView instance
184+
if (initial) {
185+
newState.room = MatrixClientPeg.get().getRoom(newState.roomId);
186+
}
187+
173188
// Clear the search results when clicking a search result (which changes the
174189
// currently scrolled to event, this.state.initialEventId).
175190
if (this.state.initialEventId !== newState.initialEventId) {
@@ -185,8 +200,9 @@ module.exports = React.createClass({
185200
this.setState(newState, () => {
186201
// At this point, this.state.roomId could be null (e.g. the alias might not
187202
// have been resolved yet) so anything called here must handle this case.
188-
this._onHaveRoom();
189-
this.onRoom(MatrixClientPeg.get().getRoom(this.state.roomId));
203+
if (initial) {
204+
this._onHaveRoom();
205+
}
190206
});
191207
},
192208

@@ -205,7 +221,7 @@ module.exports = React.createClass({
205221
// NB. We peek if we are not in the room, although if we try to peek into
206222
// a room in which we have a member event (ie. we've left) synapse will just
207223
// send us the same data as we get in the sync (ie. the last events we saw).
208-
const room = MatrixClientPeg.get().getRoom(this.state.roomId);
224+
const room = this.state.room;
209225
let isUserJoined = null;
210226
if (room) {
211227
isUserJoined = room.hasMembershipState(
@@ -220,7 +236,6 @@ module.exports = React.createClass({
220236
this.onJoinButtonClicked();
221237
} else if (this.state.roomId) {
222238
console.log("Attempting to peek into room %s", this.state.roomId);
223-
224239
this.setState({
225240
peekLoading: true,
226241
});

0 commit comments

Comments
 (0)