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

Commit

Permalink
Merge pull request #1376 from matrix-org/dbkr/fix_failed_to_load_time…
Browse files Browse the repository at this point in the history
…line_pos

Fix 'Failed to load timeline position' regression
  • Loading branch information
dbkr authored Sep 11, 2017
2 parents 7617788 + 6cb98d7 commit 7e1886c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/components/structures/RoomView.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,22 @@ module.exports = React.createClass({
if (this.unmounted) {
return;
}

if (!initial && this.state.roomId !== RoomViewStore.getRoomId()) {
// RoomView explicitly does not support changing what room
// is being viewed: instead it should just be re-mounted when
// switching rooms. Therefore, if the room ID changes, we
// ignore this. We either need to do this or add code to handle
// saving the scroll position (otherwise we end up saving the
// scroll position against the wrong room).

// Given that doing the setState here would cause a bunch of
// unnecessary work, we just ignore the change since we know
// that if the current room ID has changed from what we thought
// it was, it means we're about to be unmounted.
return;
}

const newState = {
roomId: RoomViewStore.getRoomId(),
roomAlias: RoomViewStore.getRoomAlias(),
Expand Down

0 comments on commit 7e1886c

Please sign in to comment.