You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
msglist: Suppress duplicate message on fetch/event race
Fixes#929.
When the user navigates to a narrow, the message fetch can race with
the event queue: a newly sent message appears in the fetch response
and then later arrives as a message event. Before now, the message
would get shown twice in the message list; this commit fixes that.
On handling a message event, when the message is already in the list,
skip adding a duplicate. Do adopt the event's copy of the message,
though, because the message store has done the same, and the list's
messages should remain identical to the store's so that the message
reflects subsequent update events.
Do this adoption before the narrow/haveNewest checks that gate adding
a *new* message. Those checks answer whether a new message belongs in
the list; but a message we already have must stay in sync with the
store regardless -- including in a search narrow (where containsMessage
is null) or when the list hasn't yet reached the newest message.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0 commit comments