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

Commit 44e34d9

Browse files
committed
Explain roomId workaround
1 parent 9d3ba2b commit 44e34d9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/components/structures/RoomView.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,15 @@ module.exports = React.createClass({
283283
}
284284
},
285285

286+
_getRoomId() {
287+
// According to `_onRoomViewStoreUpdate`, `state.roomId` can be null
288+
// if we have a room alias we haven't resolved yet. To work around this,
289+
// first we'll try the room object if it's there, and then fallback to
290+
// the bare room ID. (We may want to update `state.roomId` after
291+
// resolving aliases, so we could always trust it.)
292+
return this.state.room ? this.state.room.roomId : this.state.roomId;
293+
},
294+
286295
_onWidgetEchoStoreUpdate: function() {
287296
this.setState({
288297
showApps: this._shouldShowApps(this.state.room),
@@ -882,7 +891,7 @@ module.exports = React.createClass({
882891
action: 'do_after_sync_prepared',
883892
deferred_action: {
884893
action: 'view_room',
885-
room_id: this.state.room ? this.state.room.roomId : this.state.roomId,
894+
room_id: this._getRoomId(),
886895
},
887896
});
888897

0 commit comments

Comments
 (0)