From acfc7b3719946d630ede43f175b1a55494500863 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 26 Feb 2016 22:38:05 +0000 Subject: [PATCH] Don't throw exceptions when room changes in a timelinepanel This does happen - fortunately only in circumstances where it's not a problem. Downgrade the exception to a warning. Fixes https://github.com/vector-im/vector-web/issues/1036 --- src/components/structures/TimelinePanel.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 8bcd0b40b6..ce771c3bcd 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -124,7 +124,18 @@ var TimelinePanel = React.createClass({ componentWillReceiveProps: function(newProps) { if (newProps.room !== this.props.room) { - throw new Error("changing room on a TimelinePanel is not supported"); + // throw new Error("changing room on a TimelinePanel is not supported"); + + // regrettably, this does happen; in particular, when joining a + // room with /join. In that case, there are two Rooms in + // circulation - one which is created by the MatrixClient.joinRoom + // call and used to create the RoomView, and a second which is + // created by the sync loop once the room comes back down the /sync + // pipe. Once the latter happens, our room is replaced with the new one. + // + // for now, just warn about this. But we're going to end up paginating + // both rooms separately, and it's all bad. + console.warn("Replacing room on a TimelinePanel - confusion may ensue"); } if (newProps.eventId != this.props.eventId) {