Fix loading desynced messages
continuous-integration/drone/push Build is passing Details

For example, in the construct room.
This commit is contained in:
Cadence Ember 2020-11-30 22:40:44 +13:00
parent ea6ccc08ee
commit 9dce348a4c
Signed by: cadence
GPG Key ID: BC1C2C61CF521B17
1 changed files with 19 additions and 15 deletions

View File

@ -144,8 +144,7 @@ class ReactiveTimeline extends ElemJS {
} }
tryAddGroups(event, indices) { tryAddGroups(event, indices) {
const success = indices.some(i => { const createGroupAt = i => {
if (!this.list[i]) {
// if (printed++ < 100) console.log("tryadd success, created group") // if (printed++ < 100) console.log("tryadd success, created group")
if (i === -1) { if (i === -1) {
// here, -1 means at the start, before the first group // here, -1 means at the start, before the first group
@ -160,6 +159,10 @@ class ReactiveTimeline extends ElemJS {
this.list.splice(i, 0, event) this.list.splice(i, 0, event)
this.childAt(i, event) this.childAt(i, event)
} }
}
const success = indices.some(i => {
if (!this.list[i]) {
createGroupAt(i)
return true return true
} else if (event.canGroup() && this.list[i] && this.list[i].canGroup() && this.list[i].data.sender === event.data.sender) { } else if (event.canGroup() && this.list[i] && this.list[i].canGroup() && this.list[i].data.sender === event.data.sender) {
// if (printed++ < 100) console.log("tryadd success, using existing group") // if (printed++ < 100) console.log("tryadd success, using existing group")
@ -167,7 +170,8 @@ class ReactiveTimeline extends ElemJS {
return true return true
} }
}) })
if (!success) console.log("tryadd failure", indices, this.list.map(l => l.data.sender), event.data) // if (!success) console.log("tryadd failure", indices, this.list.map(l => l.data.sender), event.data) // I believe all the bugs are now fixed. Lol.
if (!success) createGroupAt(indices[0])
} }
removeGroup(group) { removeGroup(group) {