If no events and initialEventId set, try again with null

Work on Issue #35.
This commit is contained in:
N-Pex 2021-03-01 21:47:22 +01:00
parent 1ad5a5cbca
commit ae09d3a78a

View file

@ -521,7 +521,7 @@ export default {
// Joined? // Joined?
if (this.room.hasMembershipState(this.currentUser.user_id, "join")) { if (this.room.hasMembershipState(this.currentUser.user_id, "join")) {
// Yes, load everything // Yes, load everything
this.onRoomJoined(); this.onRoomJoined(this.readMarker);
} else { } else {
this.onRoomNotJoined(); this.onRoomNotJoined();
} }
@ -530,8 +530,7 @@ export default {
}, },
methods: { methods: {
onRoomJoined() { onRoomJoined(initialEventId) {
var initialEventId = this.readMarker;
console.log("Read up to " + initialEventId); console.log("Read up to " + initialEventId);
//initialEventId = null; //initialEventId = null;
@ -542,7 +541,8 @@ export default {
{} {}
); );
const self = this; const self = this;
this.timelineWindow.load(initialEventId, 20).then(() => { this.timelineWindow.load(initialEventId, 20)
.then(() => {
console.log("This is", self); console.log("This is", self);
self.events = self.timelineWindow.getEvents(); self.events = self.timelineWindow.getEvents();
@ -579,7 +579,17 @@ export default {
} }
self.restartRRTimer(); self.restartRRTimer();
}); });
}); })
.catch(err => {
console.log("Error fetching events!", err, this);
if (err.errcode == 'M_UNKNOWN' && initialEventId) {
// Try again without initial event!
this.onRoomJoined(null);
} else {
// Error. Done loading.
this.initialLoadDone = true;
}
})
}, },
onRoomNotJoined() { onRoomNotJoined() {