Skip to content

model: Message objects can be shared by message-list models, resulting in duplicated work on them #455

Closed
@chrisbobbe

Description

@chrisbobbe

Quoting from #410 (comment) :

Oh, I've noticed a subtle bug in the model code. When you have two message lists open, and a new-message event arrives, we add the same Message object to both message lists (if it belongs in both), instead of adding copies. This means that reaction events are double-processed on a single Message object. (Processed once for each message list, on the same Message instance.)

Here's a recipe for reproducing one symptom:

  1. On your account, enable "Display names of reacting users when few users have reacted to a message."
  2. Check out this PR [unnecessary; #410 was merged] and log into your account in zulip-flutter.
  3. Open "All messages".
  4. Open a topic narrow by tapping a recipient header.
  5. Send a message in that topic.
  6. In the web app, add a reaction on the message. (Any reaction, from any user).
  7. In zulip-flutter, see the name of the reacting user (or "You") appears, as expected.
  8. Repeat step 6, but with a different reaction or user.
  9. This time, in zulip-flutter, the reacting user's name is not shown; it just shows numbers. This would be expected if there were three or more reactions on the message, but in this case there are just two.

In step 9, the [Reactions.total] is 4 instead of 2 because of the double-processing.

Greg replied there:

Interesting, yeah.

I think we can let that bug not block merging this [#410], and handle it later. The fix will probably involve having a central map of messages, akin to state.messages in zulip-mobile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-modelImplementing our data model (PerAccountStore, etc.)a-msglistThe message-list screen, except what's label:a-content

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions