mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 18:25:49 +03:00
Don't paginate whilst decrypting events
As comment hopefully explains. This meant loading the app on an e2e room would often be very slow as it tried to pull hundreds of events into the timeline.
This commit is contained in:
parent
aa5d42d045
commit
e42bea6277
1 changed files with 13 additions and 0 deletions
|
@ -302,6 +302,8 @@ var TimelinePanel = React.createClass({
|
||||||
|
|
||||||
// set off a pagination request.
|
// set off a pagination request.
|
||||||
onMessageListFillRequest: function(backwards) {
|
onMessageListFillRequest: function(backwards) {
|
||||||
|
if (!this._shouldPaginate()) return Promise.resolve(false);
|
||||||
|
|
||||||
const dir = backwards ? EventTimeline.BACKWARDS : EventTimeline.FORWARDS;
|
const dir = backwards ? EventTimeline.BACKWARDS : EventTimeline.FORWARDS;
|
||||||
const canPaginateKey = backwards ? 'canBackPaginate' : 'canForwardPaginate';
|
const canPaginateKey = backwards ? 'canBackPaginate' : 'canForwardPaginate';
|
||||||
const paginatingKey = backwards ? 'backPaginating' : 'forwardPaginating';
|
const paginatingKey = backwards ? 'backPaginating' : 'forwardPaginating';
|
||||||
|
@ -1091,6 +1093,17 @@ var TimelinePanel = React.createClass({
|
||||||
}, this.props.onReadMarkerUpdated);
|
}, this.props.onReadMarkerUpdated);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_shouldPaginate: function() {
|
||||||
|
// don't try to paginate while events in the timeline are
|
||||||
|
// still being decrypted. We don't render events while they're
|
||||||
|
// being decrypted, so they don't take up space in the timeline.
|
||||||
|
// This means we can pull quite a lot of events into the timeline
|
||||||
|
// and end up trying to render a lot of events.
|
||||||
|
return !this.state.events.some((e) => {
|
||||||
|
return e.isBeingDecrypted();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
const MessagePanel = sdk.getComponent("structures.MessagePanel");
|
const MessagePanel = sdk.getComponent("structures.MessagePanel");
|
||||||
const Loader = sdk.getComponent("elements.Spinner");
|
const Loader = sdk.getComponent("elements.Spinner");
|
||||||
|
|
Loading…
Reference in a new issue