Reload the timeline when we get a gappy sync
After a resume from sleep, we don't want to start paginating through the whole timeline. If we were in 'stuckAtBottom' mode before, treat a gappy sync similarly to how we handle the 'scroll to bottom' knob, which is to reload the timelinewindow starting from scratch. Fixes https://github.com/vector-im/vector-web/issues/932, and will probably also fix https://github.com/vector-im/vector-web/issues/943, though I haven't tested it yet.
This commit is contained in:
parent
2bd6529ca0
commit
4be29401ce
1 changed files with 10 additions and 0 deletions
|
@ -113,6 +113,7 @@ var TimelinePanel = React.createClass({
|
||||||
|
|
||||||
this.dispatcherRef = dis.register(this.onAction);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline);
|
MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline);
|
||||||
|
MatrixClientPeg.get().on("Room.timelineReset", this.onRoomTimelineReset);
|
||||||
MatrixClientPeg.get().on("Room.redaction", this.onRoomRedaction);
|
MatrixClientPeg.get().on("Room.redaction", this.onRoomRedaction);
|
||||||
|
|
||||||
this._initTimeline(this.props);
|
this._initTimeline(this.props);
|
||||||
|
@ -142,6 +143,7 @@ var TimelinePanel = React.createClass({
|
||||||
var client = MatrixClientPeg.get();
|
var client = MatrixClientPeg.get();
|
||||||
if (client) {
|
if (client) {
|
||||||
client.removeListener("Room.timeline", this.onRoomTimeline);
|
client.removeListener("Room.timeline", this.onRoomTimeline);
|
||||||
|
client.removeListener("Room.timelineReset", this.onRoomTimelineReset);
|
||||||
client.removeListener("Room.redaction", this.onRoomRedaction);
|
client.removeListener("Room.redaction", this.onRoomRedaction);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -235,6 +237,14 @@ var TimelinePanel = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onRoomTimelineReset: function(room) {
|
||||||
|
if (room !== this.props.room) return;
|
||||||
|
|
||||||
|
if (this.refs.messagePanel && this.refs.messagePanel.isAtBottom()) {
|
||||||
|
this._loadTimeline();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onRoomRedaction: function(ev, room) {
|
onRoomRedaction: function(ev, room) {
|
||||||
if (this.unmounted) return;
|
if (this.unmounted) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue