fix(messages): merge partial WS updates + display edited content

message_updated broadcasts only {id, edited_content, edited_at} (+ reset
ai_* fields), but the frontend replaced the whole cached record, wiping
username/content/channel_id/created_at -> blank cards and the
'the channel_id of undefined' crash on /messages. Merge partials over the
existing record (list + detail), make list-patching channel-filter aware,
show edited content/badge, and fix the message_updated WS type.

Also broadcast type:'edited' + ai reset in message_updated so the live UI
matches the DB update.
This commit is contained in:
asepharyana
2026-08-02 10:27:41 +07:00
parent a82265f4a9
commit 3f199aa70d
6 changed files with 92 additions and 22 deletions
@@ -86,7 +86,7 @@ export function MessageCard({
deleted
</Badge>
)}
{msg.type === "edited" && (
{(msg.type === "edited" || msg.edited_content) && (
<Badge
variant="outline"
className="text-[10px] px-1.5 py-0 h-4"
@@ -102,7 +102,10 @@ export function MessageCard({
"italic text-muted-foreground line-through",
)}
>
{renderMessageContent(msg.content, msg.metadata)}
{renderMessageContent(
msg.edited_content ?? msg.content,
msg.metadata,
)}
</p>
{(() => {
const u = extractFirstImage(msg.metadata);