From ff690e50af4eb4f52defcd99983b028d20cb8c9c Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 14 Oct 2024 01:55:19 +0300 Subject: [PATCH] web/statestore: support edit event being processed after last_edit_rowid update --- web/src/api/statestore/room.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/src/api/statestore/room.ts b/web/src/api/statestore/room.ts index 6244ae4f..ac10e745 100644 --- a/web/src/api/statestore/room.ts +++ b/web/src/api/statestore/room.ts @@ -171,6 +171,13 @@ export class RoomStateStore { memEvt.orig_content = memEvt.content memEvt.content = memEvt.last_edit.content["m.new_content"] } + } else if (memEvt.relation_type === "m.replace" && memEvt.relates_to) { + const editTarget = this.eventsByID.get(memEvt.relates_to) + if (editTarget?.last_edit_rowid === memEvt.rowid && !editTarget.last_edit) { + editTarget.last_edit = memEvt + editTarget.orig_content = editTarget.content + editTarget.content = memEvt.content + } } this.eventsByRowID.set(memEvt.rowid, memEvt) this.eventsByID.set(memEvt.event_id, memEvt)