mirror of https://github.com/vector-im/riot-web
Merge pull request #3594 from matrix-org/bwindels/fixfilenotifpanel
Fix: file and notifications panel back-paginating forever.pull/21833/head
commit
d14c0c342d
|
@ -18,6 +18,7 @@ limitations under the License.
|
||||||
order: 2;
|
order: 2;
|
||||||
flex: 1 1 0;
|
flex: 1 1 0;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_FilePanel .mx_RoomView_messageListWrapper {
|
.mx_FilePanel .mx_RoomView_messageListWrapper {
|
||||||
|
|
|
@ -18,6 +18,7 @@ limitations under the License.
|
||||||
order: 2;
|
order: 2;
|
||||||
flex: 1 1 0;
|
flex: 1 1 0;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_NotificationPanel .mx_RoomView_messageListWrapper {
|
.mx_NotificationPanel .mx_RoomView_messageListWrapper {
|
||||||
|
|
|
@ -39,23 +39,10 @@ const FilePanel = createReactClass({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillMount: function() {
|
componentDidMount: function() {
|
||||||
this.updateTimelineSet(this.props.roomId);
|
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) {
|
updateTimelineSet: function(roomId) {
|
||||||
const client = MatrixClientPeg.get();
|
const client = MatrixClientPeg.get();
|
||||||
const room = client.getRoom(roomId);
|
const room = client.getRoom(roomId);
|
||||||
|
|
|
@ -759,8 +759,10 @@ module.exports = createReactClass({
|
||||||
_getMessagesHeight() {
|
_getMessagesHeight() {
|
||||||
const itemlist = this.refs.itemlist;
|
const itemlist = this.refs.itemlist;
|
||||||
const lastNode = itemlist.lastElementChild;
|
const lastNode = itemlist.lastElementChild;
|
||||||
|
const lastNodeBottom = lastNode ? lastNode.offsetTop + lastNode.clientHeight : 0;
|
||||||
|
const firstNodeTop = itemlist.firstElementChild ? itemlist.firstElementChild.offsetTop : 0;
|
||||||
// 18 is itemlist padding
|
// 18 is itemlist padding
|
||||||
return (lastNode.offsetTop + lastNode.clientHeight) - itemlist.firstElementChild.offsetTop + (18 * 2);
|
return lastNodeBottom - firstNodeTop + (18 * 2);
|
||||||
},
|
},
|
||||||
|
|
||||||
_topFromBottom(node) {
|
_topFromBottom(node) {
|
||||||
|
|
Loading…
Reference in New Issue