You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
correctly notify when timelineSets get reset
This commit is contained in:
@@ -196,13 +196,11 @@ Room.prototype.getLiveTimeline = function() {
|
||||
|
||||
|
||||
/**
|
||||
* Reset the live timeline, and start a new one.
|
||||
* Reset the live timeline of all timelineSets, and start new ones.
|
||||
*
|
||||
* <p>This is used when /sync returns a 'limited' timeline.
|
||||
*
|
||||
* @param {string=} backPaginationToken token for back-paginating the new timeline
|
||||
*
|
||||
* @fires module:client~MatrixClient#event:"Room.timelineReset"
|
||||
*/
|
||||
Room.prototype.resetLiveTimeline = function(backPaginationToken) {
|
||||
for (var i = 0; i < this._timelineSets.length; i++) {
|
||||
@@ -210,7 +208,6 @@ Room.prototype.resetLiveTimeline = function(backPaginationToken) {
|
||||
}
|
||||
|
||||
this._fixUpLegacyTimelineFields();
|
||||
this.emit("Room.timelineReset", this);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -464,7 +461,7 @@ Room.prototype.getOrCreateFilteredTimelineSet = function(filter) {
|
||||
}
|
||||
var opts = Object.assign({ filter: filter }, this._opts);
|
||||
var timelineSet = new EventTimelineSet(this, opts);
|
||||
reEmit(this, timelineSet, ["Room.timeline"]);
|
||||
reEmit(this, timelineSet, ["Room.timeline", "Room.timelineReset"]);
|
||||
this._filteredTimelineSets[filter.filterId] = timelineSet;
|
||||
this._timelineSets.push(timelineSet);
|
||||
|
||||
@@ -1321,18 +1318,6 @@ module.exports = Room;
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fires whenever the live timeline in a room is reset.
|
||||
*
|
||||
* When we get a 'limited' sync (for example, after a network outage), we reset
|
||||
* the live timeline to be empty before adding the recent events to the new
|
||||
* timeline. This event is fired after the timeline is reset, and before the
|
||||
* new events are added.
|
||||
*
|
||||
* @event module:client~MatrixClient#"Room.timelineReset"
|
||||
* @param {Room} room The room whose live timeline was reset.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fires when the status of a transmitted event is updated.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user