Fix loading desynced messages
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
For example, in the construct room.
This commit is contained in:
parent
ea6ccc08ee
commit
9dce348a4c
1 changed files with 19 additions and 15 deletions
|
@ -144,22 +144,25 @@ class ReactiveTimeline extends ElemJS {
|
|||
}
|
||||
|
||||
tryAddGroups(event, indices) {
|
||||
const createGroupAt = i => {
|
||||
// if (printed++ < 100) console.log("tryadd success, created group")
|
||||
if (i === -1) {
|
||||
// here, -1 means at the start, before the first group
|
||||
i = 0 // jank but it does the trick
|
||||
}
|
||||
if (event.canGroup()) {
|
||||
const group = new EventGroup(this, [event])
|
||||
this.list.splice(i, 0, group)
|
||||
this.childAt(i, group)
|
||||
event.setGroup(group)
|
||||
} else {
|
||||
this.list.splice(i, 0, event)
|
||||
this.childAt(i, event)
|
||||
}
|
||||
}
|
||||
const success = indices.some(i => {
|
||||
if (!this.list[i]) {
|
||||
// if (printed++ < 100) console.log("tryadd success, created group")
|
||||
if (i === -1) {
|
||||
// here, -1 means at the start, before the first group
|
||||
i = 0 // jank but it does the trick
|
||||
}
|
||||
if (event.canGroup()) {
|
||||
const group = new EventGroup(this, [event])
|
||||
this.list.splice(i, 0, group)
|
||||
this.childAt(i, group)
|
||||
event.setGroup(group)
|
||||
} else {
|
||||
this.list.splice(i, 0, event)
|
||||
this.childAt(i, event)
|
||||
}
|
||||
createGroupAt(i)
|
||||
return true
|
||||
} 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")
|
||||
|
@ -167,7 +170,8 @@ class ReactiveTimeline extends ElemJS {
|
|||
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) {
|
||||
|
|
Loading…
Reference in a new issue