diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index f75393c6db..b233662898 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -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(), }, });