From 59a743de015d39f339e3a4f6f930380436339a57 Mon Sep 17 00:00:00 2001 From: evykassirer Date: Tue, 28 May 2024 17:58:29 -0700 Subject: [PATCH] reify_message_id: Save id on most up-to-date message object. Previously we relied on `echo.reify_message_id` to set the new `id` and `locally_echoed` value, but it was setting this on the message stored in `waiting_for_id`, which isn't guaranteed to be the same as the message in the message store. Once `process_new_message` stops mutating the message it gets and returns a new message object, this would have caused a bug. --- web/src/message_store.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/src/message_store.ts b/web/src/message_store.ts index e816f999b8..46ef2b1ed9 100644 --- a/web/src/message_store.ts +++ b/web/src/message_store.ts @@ -275,6 +275,8 @@ export function update_status_emoji_info( export function reify_message_id({old_id, new_id}: {old_id: number; new_id: number}): void { const message = stored_messages.get(old_id); if (message !== undefined) { + message.id = new_id; + message.locally_echoed = false; stored_messages.set(new_id, message); stored_messages.delete(old_id); }