Skip to content

Commit 513201b

Browse files
authored
Warn when we drop an event trying to add it to a thread (#3785)
Added to try and help debug element-hq/element-web#26254
1 parent 02ca5c7 commit 513201b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/models/thread.ts

+20
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,26 @@ export class Thread extends ReadReceipt<ThreadEmittedEvents, ThreadEventHandlerM
367367
this.timelineSet.relations?.aggregateParentEvent(event);
368368
this.timelineSet.relations?.aggregateChildEvent(event, this.timelineSet);
369369
return;
370+
} else if (this.initialEventsFetched) {
371+
// If initial events have not been fetched, we are OK to throw away
372+
// this event, because we are about to fetch all the events for this
373+
// thread from the server.
374+
//
375+
// If not, this looks like a bug - we should always add the event to
376+
// the thread. See https://github.com/vector-im/element-web/issues/26254
377+
logger.warn(
378+
`Not adding event ${event.getId()} to thread timeline!
379+
isNewestReply=${isNewestReply}
380+
event.localTimestamp=${event.localTimestamp}
381+
!!lastReply=${!!lastReply}
382+
lastReply?.getId()=${lastReply?.getId()}
383+
lastReply?.localTimestamp=${lastReply?.localTimestamp}
384+
toStartOfTimeline=${toStartOfTimeline}
385+
Thread.hasServerSideSupport=${Thread.hasServerSideSupport}
386+
event.isRelation(RelationType.Annotation)=${event.isRelation(RelationType.Annotation)}
387+
event.isRelation(RelationType.Replace)=${event.isRelation(RelationType.Replace)}
388+
`,
389+
);
370390
}
371391

372392
if (

0 commit comments

Comments
 (0)