Explain roomId workaround

This commit is contained in:
J. Ryan Stinnett 2019-02-12 08:59:38 +00:00
parent 9d3ba2b3d9
commit 44e34d9074

View File

@ -283,6 +283,15 @@ module.exports = React.createClass({
}
},
_getRoomId() {
// According to `_onRoomViewStoreUpdate`, `state.roomId` can be null
// if we have a room alias we haven't resolved yet. To work around this,
// first we'll try the room object if it's there, and then fallback to
// the bare room ID. (We may want to update `state.roomId` after
// resolving aliases, so we could always trust it.)
return this.state.room ? this.state.room.roomId : this.state.roomId;
},
_onWidgetEchoStoreUpdate: function() {
this.setState({
showApps: this._shouldShowApps(this.state.room),
@ -882,7 +891,7 @@ module.exports = React.createClass({
action: 'do_after_sync_prepared',
deferred_action: {
action: 'view_room',
room_id: this.state.room ? this.state.room.roomId : this.state.roomId,
room_id: this._getRoomId(),
},
});