Skip to content

Commit

Permalink
Warn when we drop an event trying to add it to a thread
Browse files Browse the repository at this point in the history
Added to try and help debug element-hq/element-web#26254
  • Loading branch information
andybalaam committed Oct 6, 2023
1 parent 02ca5c7 commit ceb2076
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/models/thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,26 @@ export class Thread extends ReadReceipt<ThreadEmittedEvents, ThreadEventHandlerM
this.timelineSet.relations?.aggregateParentEvent(event);
this.timelineSet.relations?.aggregateChildEvent(event, this.timelineSet);
return;
} else if (this.initialEventsFetched) {
// If initial events have not been fetched, we are OK to throw away
// this event, because we are about to fetch all the events for this
// thread from the server.
//
// If not, this looks like a bug - we should always add the event to
// the thread. See https://github.com/vector-im/element-web/issues/26254
logger.warn(
`Not adding event ${event.getId()} to thread timeline!
isNewestReply=${isNewestReply}
event.localTimestamp=${event.localTimestamp}
!!lastReply=${!!lastReply}
lastReply?.getId()=${lastReply?.getId()}
lastReply?.localTimestamp=${lastReply?.localTimestamp}
toStartOfTimeline=${toStartOfTimeline}
Thread.hasServerSideSupport=${Thread.hasServerSideSupport}
event.isRelation(RelationType.Annotation)=${event.isRelation(RelationType.Annotation)}
event.isRelation(RelationType.Replace)=${event.isRelation(RelationType.Replace)}
`,
);
}

if (
Expand Down

0 comments on commit ceb2076

Please sign in to comment.