mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
prevent error when nextProps is null, cleanup
As the FilePanel is now rendered as part of the RoomView, we don't need to respond to room changes, as RoomView has a key of the roomId, so the whole subtree would be recreated.
This commit is contained in:
parent
9fa7990996
commit
842bf77409
@ -39,23 +39,10 @@ const FilePanel = createReactClass({
|
||||
};
|
||||
},
|
||||
|
||||
componentWillMount: function() {
|
||||
componentDidMount: function() {
|
||||
this.updateTimelineSet(this.props.roomId);
|
||||
},
|
||||
|
||||
componentWillReceiveProps: function(nextProps) {
|
||||
if (nextProps.roomId !== this.props.roomId) {
|
||||
// otherwise we race between re-rendering the TimelinePanel and setting the new timelineSet.
|
||||
//
|
||||
// FIXME: this race only happens because of the promise returned by getOrCreateFilter().
|
||||
// We should only need to create the containsUrl filter once per login session, so in practice
|
||||
// it shouldn't be being done here at all. Then we could just update the timelineSet directly
|
||||
// without resetting it first, and speed up room-change.
|
||||
this.setState({ timelineSet: null });
|
||||
this.updateTimelineSet(nextProps.roomId);
|
||||
}
|
||||
},
|
||||
|
||||
updateTimelineSet: function(roomId) {
|
||||
const client = MatrixClientPeg.get();
|
||||
const room = client.getRoom(roomId);
|
||||
|
Loading…
Reference in New Issue
Block a user