mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-08-07 09:12:57 +02:00
fix(websocket): update message metadata in-place without full chat reload
Instead of reloading the entire message list when echo data arrives, now updates only the affected message elements in the DOM: - Add data-msg-id attribute to message wrappers for targeted lookup - Add GET /api/messages/<id>/meta endpoint returning metadata for a single message (computes pkt_payload, looks up echoes, analyzer URL) - Replace loadMessages() echo handler with refreshMessagesMeta() that finds messages missing metadata and updates them individually - Fix path_len=0 treated as falsy (use ?? instead of ||) Flow: message appears instantly via WebSocket (with SNR + hops), then ~2s later echo data triggers targeted meta fetch → route info and analyzer button appear smoothly without any chat window reload. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -328,6 +328,13 @@ class Database:
|
||||
)
|
||||
return cursor.lastrowid
|
||||
|
||||
def get_channel_message_by_id(self, msg_id: int) -> Optional[Dict]:
|
||||
with self._connect() as conn:
|
||||
row = conn.execute(
|
||||
"SELECT * FROM channel_messages WHERE id = ?", (msg_id,)
|
||||
).fetchone()
|
||||
return dict(row) if row else None
|
||||
|
||||
def get_channel_messages(self, channel_idx: int = None, limit: int = 50,
|
||||
offset: int = 0, days: int = None) -> List[Dict]:
|
||||
with self._connect() as conn:
|
||||
|
||||
Reference in New Issue
Block a user