mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-24 03:55:09 +01:00
fix the race
This commit is contained in:
parent
84ecaa2ee1
commit
365bd5cad0
@ -145,6 +145,17 @@ export class Timeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_addLocalRelationsToNewRemoteEntries(entries) {
|
_addLocalRelationsToNewRemoteEntries(entries) {
|
||||||
|
// because it is not safe to iterate a derived observable collection
|
||||||
|
// before it has any subscriptions, we bail out if this isn't
|
||||||
|
// the case yet. This can happen when sync adds or replaces entries
|
||||||
|
// before load has finished and the view has subscribed to the timeline.
|
||||||
|
//
|
||||||
|
// Once the subscription is setup, MappedList will set up the local
|
||||||
|
// relations as needed with _applyAndEmitLocalRelationChange,
|
||||||
|
// so we're not missing anything by bailing out.
|
||||||
|
if (!this._localEntries.hasSubscriptions) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// find any local relations to this new remote event
|
// find any local relations to this new remote event
|
||||||
for (const pee of this._localEntries) {
|
for (const pee of this._localEntries) {
|
||||||
// this will work because we set relatedEventId when removing remote echos
|
// this will work because we set relatedEventId when removing remote echos
|
||||||
|
Loading…
Reference in New Issue
Block a user