aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-18 11:57:12 -0700
committerAdam Soltys <[email protected]>2026-08-18 11:57:12 -0700
commit3d80fef6aeab03795c4257ab8c4f27113d7e9022 (patch)
tree2faa0cadba207030ce640f1f8a6fd7bf46202823 /src
parentc553ea40de4aecd9453272599d450310d6e306b0 (diff)
downloadcoinosv3-3d80fef6aeab03795c4257ab8c4f27113d7e9022.tar.gz
coinosv3-3d80fef6aeab03795c4257ab8c4f27113d7e9022.zip
The composer lets go of a sent message: the morph rightly won't rewrite a focused field, so sending clears the live input itself, not just the draft state
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012u4oe1KPx9faCsDBLfZYqi
Diffstat (limited to 'src')
-rw-r--r--src/features/messages.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 02affc9..969f4e8 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -376,6 +376,16 @@ export function messagesFeature(ctx) {
save(s);
}
+ // The morph never rewrites a focused field's value (it would fight the user
+ // mid-keystroke), and the composer is focused at the moment you send — so
+ // clearing ui.msgDraft alone leaves the sent text sitting in the input.
+ // Clear the live element too.
+ function clearDraft() {
+ ui.msgDraft = '';
+ const inp = document.getElementById('msg-draft');
+ if (inp) inp.value = '';
+ }
+
async function sendMessage(room, chId) {
const text = (ui.msgDraft || '').trim();
if (!text || ui.msgSending) return;
@@ -397,7 +407,7 @@ export function messagesFeature(ctx) {
const msgs = room.byChannel.get(chId) || room.byChannel.set(chId, new Map()).get(chId);
msgs.set(opened.rumor.id, opened);
}
- ui.msgDraft = '';
+ clearDraft();
const ok = await publishOn(room.relays, wrap);
if (!ok) toast(t('msgSendFailed'));
ensureJoined(room, id).catch(() => {});
@@ -1003,7 +1013,7 @@ export function messagesFeature(ctx) {
try {
const { rumor, toPeer, toSelf } = await makeDM(id.signer, peer, text);
noteDM(peer, rumor, true);
- ui.msgDraft = '';
+ clearDraft();
const inbox = (await fetchInboxRelays(peer)).slice(0, 4);
const ok = await publishOn([...new Set([...inbox, ...DM_RELAYS])], toPeer);
publishOn(DM_RELAYS, toSelf);