fix: codex S2 review — race conditions, try/finally, scroll, compose reset

- channel switch clears messages immediately, prevents stale fetch overwrite
- auto-scroll only on NEW messages (not every poll cycle)
- ComposeBox keyed by channelId — resets draft on switch
- try/finally on all mutations — failed sends don't disable compose
- loadChannels no longer re-fetches on every channel select

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 19:30:00 +02:00
parent 20196c23a8
commit 9e35984813
3 changed files with 53 additions and 28 deletions

View File

@@ -30,16 +30,19 @@ export function ComposeBox({
async function handleSend() {
if (!content.trim() || sending) return;
setSending(true);
await postMessage(channelId, {
content: content.trim(),
type: msgType,
reply_to: replyTo ?? undefined,
});
setContent("");
setMsgType("text");
onClearReply();
onMessageSent();
setSending(false);
try {
await postMessage(channelId, {
content: content.trim(),
type: msgType,
reply_to: replyTo ?? undefined,
});
setContent("");
setMsgType("text");
onClearReply();
onMessageSent();
} finally {
setSending(false);
}
}
return (