Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relation event insertion breaks during backwards pagination if parent is on another page (if supportsThreads: true) #3937

Open
davidisaaclee opened this issue Dec 2, 2023 · 0 comments

Comments

@davidisaaclee
Copy link
Contributor

Assume that we have a PARENT event a CHILD event which is an m.replace of PARENT, sent a long time after PARENT was sent (so there are some pages between the two events).

If I have supportsThreads: true, and I'm backfilling the room via paginateEventTimeline (going in backwards direction), I hit CHILD first, going through addEventsToTimeline -> eventShouldLiveIn, leading me to...

parentEvent = this.findEventById(parentEventId) ?? events?.find((e) => e.getId() === parentEventId);

Since I didn't hit PARENT yet (and it is not in the page that is currently being processed, i.e. events), parentEvent is not found, causing the following case to fail (I think this case is the one that should be hit, although we don't have parent so we can't recur):

// Treat non-thread-relations, redactions, and replies as extensions of their parents so evaluate parentEvent instead
if (parentEvent && !isThreadRelation) {
return this.eventShouldLiveIn(parentEvent, events, roots);
}

All other branches fail, causing the function to return:

// We've exhausted all scenarios,
// we cannot assume that it lives in the main timeline as this may be a relation for an unknown thread
// adding the event in the wrong timeline causes stuck notifications and can break ability to send read receipts
return {
shouldLiveInRoom: false,
shouldLiveInThread: false,
};

This omits CHILD from the timeline (and I think shows PARENT instead?).

(I'm probably going to just disable supportsThreads to workaround this for myself.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant