Skip to content

Commit

Permalink
web/statestore: support edit event being processed after last_edit_ro…
Browse files Browse the repository at this point in the history
…wid update
  • Loading branch information
tulir committed Oct 13, 2024
1 parent 464cd3f commit ff690e5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions web/src/api/statestore/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ff690e5

Please sign in to comment.