Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(chat): prevent duplicate message on rapid send

Steven Enamakelcd6f9ad3f4d5
diff --git a/app/src/components/chat/ChatComposer.tsx b/app/src/components/chat/ChatComposer.tsx
index a9825abf93..d1bd6fe9d5 100644
--- a/app/src/components/chat/ChatComposer.tsx
+++ b/app/src/components/chat/ChatComposer.tsx
@@ -458,37 +458,38 @@ function ChatComposerBody({
follow-up is typed the Send arrow returns so the follow-up can be
queued (parallel send) instead of cancelling the current turn. */}
{showStopButton ? (
- <Button
- type="button"
- iconOnly
- variant="primary"
- size="xs"
- analyticsId="chat-composer-stop"
- data-testid="stop-generation-button"
- aria-label={t('chat.stopGeneration')}
- title={t('chat.stopGeneration')}
- onClick={onStopGeneration}
- className={COMPOSER_SEND}>
- <StopIcon />
- </Button>
- ) : (
- <Button
- type="button"
- iconOnly
- variant="primary"
- size="xs"
- analyticsId="chat-composer-send"
- data-testid="send-message-button"
- aria-label={t('chat.send')}
- title={t('chat.send')}
- onClick={() => {
- debug('[chat-composer] send click: parallel=%s', allowParallelSend);
- void onSend();
- }}
- disabled={!hasContent || composerLocked}
- className={COMPOSER_SEND}>
- {showSendingSpinner ? <SendingSpinnerIcon /> : <SendIcon />}
- </Button>
+ <Button
+ type="button"
+ iconOnly
+ variant="primary"
+ size="xs"
+ analyticsId="chat-composer-stop"
+ data-testid="stop-generation-button"
+ aria-label={t('chat.stopGeneration')}
+ title={t('chat.stopGeneration')}
+ onClick={onStopGeneration}
+ className={COMPOSER_SEND}>
+ <StopIcon />
+ </Button>
+ ) : (
+ <Button
+ type="button"
+ iconOnly
+ variant="primary"
+ size="xs"
+ analyticsId="chat-composer-send"
+ data-testid="send-message-button"
+ aria-label={t('chat.send')}
+ title={t('chat.send')}
+ onClick={() => {
+ debug('[chat-composer] send click: parallel=%s', allowParallelSend);
+ void onSend();
+ }}
+ disabled={!hasContent || composerLocked}
+ className={COMPOSER_SEND}>
+ {showSendingSpinner ? <SendingSpinnerIcon /> : <SendIcon />}
+ </Button>
+ </div>
)}
</div>
</div>