matrix-org / matrix-org/matrix-rust-sdk

Sending a message in the timeline makes it "bounce" on screen

Open
#6,398 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-Event cache
Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

App users (cc @ara4n) have reported that a message sent in the EX apps would "bounce" on screen: first appear, then disappear and reappear quickly, after a short amount of time.

https://github.com/matrix-org/matrix-rust-sdk/pull/6397 shows this behavior in a test. After sending the event, it is saved in the send queue (making the bouncing behavior a fallout of https://github.com/matrix-org/matrix-rust-sdk/pull/5920). The event timeline item state moves from not-sent-yet to sent, with the same TimelineUniqueId. After the remote echo has been received from sync, the event is deduplicated in the event cache, so the updates that are triggered are the following:

  • delete the duplicate event (Remove vector diff update)
  • insert it back at the expected position (PushBack / PushFront / Insert vector diff update)

Even though the reinserted item reuses the same TimelineUniqueId, it might not be sufficient for embedders to detect that this is a Set in disguise, so the event is first removed from the timeline, and then reinserted.

I think that to properly handle such a case, we'd need some kind of position-aware deduplication mechanism: identify a common head and tail between a list of known events and a list of new events, which would avoid Remove/Insert sequences, so we can turn them into Set instead.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the behavior shown by matrix-rust-sdk#6397 and the send-queue change in matrix-rust-sdk#5920. Trace the event timeline updates, TimelineUniqueId reuse, event-cache deduplication, and resulting Remove/Insert vector diffs; done means the remote echo no longer makes the message visibly disappear and reappear.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.