@@ -170,6 +170,21 @@ module.exports = React.createClass({
170
170
isInitialEventHighlighted : RoomViewStore . isInitialEventHighlighted ( ) ,
171
171
} ;
172
172
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
+
173
188
// Clear the search results when clicking a search result (which changes the
174
189
// currently scrolled to event, this.state.initialEventId).
175
190
if ( this . state . initialEventId !== newState . initialEventId ) {
@@ -185,8 +200,9 @@ module.exports = React.createClass({
185
200
this . setState ( newState , ( ) => {
186
201
// At this point, this.state.roomId could be null (e.g. the alias might not
187
202
// 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
+ }
190
206
} ) ;
191
207
} ,
192
208
@@ -205,7 +221,7 @@ module.exports = React.createClass({
205
221
// NB. We peek if we are not in the room, although if we try to peek into
206
222
// a room in which we have a member event (ie. we've left) synapse will just
207
223
// 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 ;
209
225
let isUserJoined = null ;
210
226
if ( room ) {
211
227
isUserJoined = room . hasMembershipState (
@@ -220,7 +236,6 @@ module.exports = React.createClass({
220
236
this . onJoinButtonClicked ( ) ;
221
237
} else if ( this . state . roomId ) {
222
238
console . log ( "Attempting to peek into room %s" , this . state . roomId ) ;
223
-
224
239
this . setState ( {
225
240
peekLoading : true ,
226
241
} ) ;
0 commit comments