webui(chat): Send button passes the click event as sendMessage's retry arg, throws and no-ops #954

Closed
opened 2026-10-27 13:38:26 +00:00 by sam · 0 comments
Owner

ui/src/chat/chat.js line 283:

send.onclick = sendMessage;

sendMessage(retry = null) is assigned directly as a DOM onclick handler. The browser invokes onclick handlers with the triggering MouseEvent as the first argument, so every click calls sendMessage(event) -- the click event becomes retry. It's truthy and has no .turn property, so the very first line of the function:

const text = retry?.turn.text || composer.value.trim();

throws TypeError: can't access property "text", t.turn is undefined (t being the minified param name) immediately, before any state changes (the disable/status-update code runs after this line). The click is silently swallowed -- no message sent, no visible error, Send just does nothing.

Reported live on carina 2026-08-09: clicking Send in the dashboard chat had no effect; browser console showed the above uncaught promise rejection at index.js:77.

Fix

send.onclick = () => sendMessage(); (matching the pattern already used for newChat.onclick a few lines up), so no arguments reach sendMessage from the click event.


Imported from beads archie-core-1786637501063-426-9fce1209 · GitHub #447 · type bug · priority P2 · created 2026-08-08 · closed 2026-08-08

`ui/src/chat/chat.js` line 283: ```js send.onclick = sendMessage; ``` `sendMessage(retry = null)` is assigned directly as a DOM `onclick` handler. The browser invokes `onclick` handlers with the triggering `MouseEvent` as the first argument, so every click calls `sendMessage(event)` -- the click event becomes `retry`. It's truthy and has no `.turn` property, so the very first line of the function: ```js const text = retry?.turn.text || composer.value.trim(); ``` throws `TypeError: can't access property "text", t.turn is undefined` (`t` being the minified param name) immediately, before any state changes (the disable/status-update code runs after this line). The click is silently swallowed -- no message sent, no visible error, Send just does nothing. Reported live on carina 2026-08-09: clicking Send in the dashboard chat had no effect; browser console showed the above uncaught promise rejection at `index.js:77`. ### Fix `send.onclick = () => sendMessage();` (matching the pattern already used for `newChat.onclick` a few lines up), so no arguments reach `sendMessage` from the click event. --- _Imported from beads `archie-core-1786637501063-426-9fce1209` · GitHub #447 · type bug · priority P2 · created 2026-08-08 · closed 2026-08-08_
sam added the mediumbug labels 2026-10-27 13:38:26 +00:00
sam self-assigned this 2026-10-27 13:38:26 +00:00
sam closed this issue 2026-10-27 13:38:26 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#954