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:
@@ -27,7 +27,12 @@ export interface WsBinaryEvent {
|
||||
|
||||
export interface WsEventMap {
|
||||
message_created: MessageRecord;
|
||||
message_updated: MessageRecord;
|
||||
/**
|
||||
* The gateway broadcasts a PARTIAL update: { id } plus the changed fields
|
||||
* (edited_content, edited_at, type, and the reset ai_* fields). It is NOT a
|
||||
* full MessageRecord — merge it, never rely on it carrying the full row.
|
||||
*/
|
||||
message_updated: Partial<MessageRecord> & { id: string };
|
||||
/** Gateway emits { id, deleted_at } — NOT a bare string */
|
||||
message_deleted: { id: string; deleted_at?: number };
|
||||
message_analyzed: MessageRecord;
|
||||
|
||||
Reference in New Issue
Block a user