composer: persist the draft on input, keep unconfirmed sends in a durable outbox #122
Loading…
Reference in a new issue
No description provided.
Delete branch "void/draft-persist"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Cause: the draft lived in a memory-only jotai atom (
roomIdToMsgDraftAtomFamily) written only when RoomInput unmounted, so a reload lost it; a sent message left the editor at once and was held nowhere durable (js-sdk pending events are not persisted).Fix:
composerStore.ts(localStorage, per account/room): draft written debounced on input and flushed on pagehide/hidden, restored on load; outbox entry written at send under a txn id, removed only when sendMessage resolves, marked failed on rejection.RoomOutboxshows pending/failed entries above the composer with Resend (same txn id, so a send that did land is deduplicated) and Discard.Not covered: file uploads, reply draft, edit drafts; a message sent from a tab that dies before the localStorage write.
🤖 Generated with Claude Code