Skip to content

Commit 207d60f

Browse files
only21milclaude
andcommitted
fix(web): an image-only send that fails behind a new draft now says so
When a send with only an image failed while a new draft was in the composer, its message left the timeline with no toast, so an interrupted first send of a new thread vanished without a word. The failure toast now shows for it too, without a Copy action since there is no text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent bdf3326 commit 207d60f

1 file changed

Lines changed: 28 additions & 20 deletions

File tree

‎apps/web/src/components/chat/useComposerSend.ts‎

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,26 +1412,34 @@ export function useComposerSend(input: ComposerSendInput) {
14121412
) {
14131413
// A draft typed meanwhile keeps the composer, so the failed text stays reachable here.
14141414
const failedText = sendSnapshot.draftText;
1415-
if (failedText.trim().length > 0) {
1416-
toastManager.add(
1417-
stackedThreadToast({
1418-
type: "error",
1419-
title: isAtomCommandInterrupted(failure)
1420-
? "Message may not have been sent"
1421-
: "Message not sent",
1422-
description: "Your new draft was kept. Copy the failed message to send it again.",
1423-
// The toast holds the only copy of the failed text, so it stays until dismissed.
1424-
timeout: 0,
1425-
data: { hideCopyButton: true },
1426-
actionProps: {
1427-
children: "Copy message",
1428-
onClick: () => {
1429-
void writeTextToClipboard(failedText, "failed message").catch(() => undefined);
1430-
},
1431-
},
1432-
}),
1433-
);
1434-
}
1415+
const hasText = failedText.trim().length > 0;
1416+
// An image-only message has nothing to copy, but its failure still needs a notice.
1417+
toastManager.add(
1418+
stackedThreadToast({
1419+
type: "error",
1420+
title: isAtomCommandInterrupted(failure)
1421+
? "Message may not have been sent"
1422+
: "Message not sent",
1423+
description: hasText
1424+
? "Your new draft was kept. Copy the failed message to send it again."
1425+
: "Your new draft was kept.",
1426+
// The toast holds the only trace of the failed message, so it stays until dismissed.
1427+
timeout: 0,
1428+
data: { hideCopyButton: true },
1429+
...(hasText
1430+
? {
1431+
actionProps: {
1432+
children: "Copy message",
1433+
onClick: () => {
1434+
void writeTextToClipboard(failedText, "failed message").catch(
1435+
() => undefined,
1436+
);
1437+
},
1438+
},
1439+
}
1440+
: {}),
1441+
}),
1442+
);
14351443
} else {
14361444
const retryComposerImages = restoreComposerDraft(composerDraftTarget, sendSnapshot);
14371445
if (currentRouteThreadKeyRef.current === routeThreadKey) {

0 commit comments

Comments
 (0)