fix(chat): dedup sent message in sendMessage too (WS echo can beat the POST response)
The server echoes the sender's own message over WS before returning the HTTP response, so onChatMessage could append it before sendMessage's await resolved, then sendMessage appended again -> double. Both append paths now dedup by id. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
이 커밋은 다음에 포함됨:
+5
-2
@@ -589,7 +589,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="/icons.js?v=3"></script>
|
<script src="/icons.js?v=3"></script>
|
||||||
<script>window.__BUILD='2026-06-24-push1';console.log('%cBizGaze Connect','color:#1F3B73;font-weight:bold','build '+window.__BUILD);</script>
|
<script>window.__BUILD='2026-06-24-push2';console.log('%cBizGaze Connect','color:#1F3B73;font-weight:bold','build '+window.__BUILD);</script>
|
||||||
<div class="loading" id="loading">Loading…</div>
|
<div class="loading" id="loading">Loading…</div>
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
@@ -1433,7 +1433,10 @@ async function sendMessage(){
|
|||||||
try{
|
try{
|
||||||
const m=await postJSON('/api/messages', payload);
|
const m=await postJSON('/api/messages', payload);
|
||||||
composeMentions=new Map();
|
composeMentions=new Map();
|
||||||
THREAD.push(m); appendBubble(m); clearReply(); pendingAttach=null; hideAttach();
|
// Dedup by id: the server echoes our message over WS (to sync other tabs) and that echo
|
||||||
|
// can arrive BEFORE this POST resolves, so onChatMessage may have already appended it.
|
||||||
|
if(!THREAD.some(x=>x.id===m.id)){ THREAD.push(m); appendBubble(m); }
|
||||||
|
clearReply(); pendingAttach=null; hideAttach();
|
||||||
{ const ck=selected.kind+':'+selected.id; if(THREAD_CACHE.has(ck)){ const a=THREAD_CACHE.get(ck); if(!a.some(x=>x.id===m.id)) a.push(m); } }
|
{ const ck=selected.kind+':'+selected.id; if(THREAD_CACHE.has(ck)){ const a=THREAD_CACHE.get(ck); if(!a.some(x=>x.id===m.id)) a.push(m); } }
|
||||||
const it=rowFor(selected.kind,selected.id);
|
const it=rowFor(selected.kind,selected.id);
|
||||||
if(it){ it.last_body=m.body||(m.attachment?'📎 '+(m.attachment.name||'Attachment'):''); it.last_at=m.created_at; it.last_from_me=true; it.unread=0; }
|
if(it){ it.last_body=m.body||(m.attachment?'📎 '+(m.attachment.name||'Attachment'):''); it.last_at=m.created_at; it.last_from_me=true; it.unread=0; }
|
||||||
|
|||||||
새 이슈에서 참조
사용자 차단