diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index bc997220d..2df5ec6c0 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -3597,6 +3597,15 @@ export default function ChatView({ threadId }: ChatViewProps) { setQueuedMessages([]); }, []); + const onRemoveQueuedMessage = useCallback((messageId: MessageId) => { + setOptimisticUserMessages((existing) => { + const target = existing.find((msg) => msg.id === messageId && msg.queued); + if (target) revokeUserMessagePreviewUrls(target); + return existing.filter((msg) => msg.id !== messageId); + }); + setQueuedMessages((existing) => existing.filter((msg) => msg.id !== messageId)); + }, []); + const onRespondToApproval = useCallback( async (requestId: ApprovalRequestId, decision: ProviderApprovalDecision) => { const api = readNativeApi(); @@ -4737,6 +4746,7 @@ export default function ChatView({ threadId }: ChatViewProps) { timestampFormat={timestampFormat} workspaceRoot={activeProject?.cwd ?? undefined} shortcutGuides={chatShortcutGuides} + onRemoveQueuedMessage={onRemoveQueuedMessage} onOpenSettings={() => void navigate({ to: "/settings" })} /> diff --git a/apps/web/src/components/chat/MessagesTimeline.test.tsx b/apps/web/src/components/chat/MessagesTimeline.test.tsx index c81a4ebff..8237942c5 100644 --- a/apps/web/src/components/chat/MessagesTimeline.test.tsx +++ b/apps/web/src/components/chat/MessagesTimeline.test.tsx @@ -102,6 +102,7 @@ describe("MessagesTimeline", () => { resolvedTheme="light" timestampFormat="locale" workspaceRoot={undefined} + onRemoveQueuedMessage={() => {}} shortcutGuides={EMPTY_SHORTCUT_GUIDES} onOpenSettings={() => {}} />, @@ -149,6 +150,7 @@ describe("MessagesTimeline", () => { resolvedTheme="light" timestampFormat="locale" workspaceRoot={undefined} + onRemoveQueuedMessage={() => {}} shortcutGuides={EMPTY_SHORTCUT_GUIDES} onOpenSettings={() => {}} />, @@ -183,6 +185,7 @@ describe("MessagesTimeline", () => { resolvedTheme="light" timestampFormat="locale" workspaceRoot={undefined} + onRemoveQueuedMessage={() => {}} shortcutGuides={EMPTY_SHORTCUT_GUIDES} onOpenSettings={() => {}} />, diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx index 887774191..f98c6a458 100644 --- a/apps/web/src/components/chat/MessagesTimeline.tsx +++ b/apps/web/src/components/chat/MessagesTimeline.tsx @@ -33,6 +33,7 @@ import { TerminalIcon, Undo2Icon, WrenchIcon, + XIcon, ZapIcon, } from "lucide-react"; import { Button } from "../ui/button"; @@ -87,6 +88,7 @@ interface MessagesTimelineProps { resolvedTheme: "light" | "dark"; timestampFormat: TimestampFormat; workspaceRoot: string | undefined; + onRemoveQueuedMessage: (messageId: MessageId) => void; shortcutGuides: ChatShortcutGuide[]; onOpenSettings: () => void; } @@ -113,6 +115,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({ resolvedTheme, timestampFormat, workspaceRoot, + onRemoveQueuedMessage, shortcutGuides, onOpenSettings, }: MessagesTimelineProps) { @@ -508,9 +511,16 @@ export const MessagesTimeline = memo(function MessagesTimeline({
{isQueued && ( - + )}

{formatTimestamp(row.message.createdAt, timestampFormat, resolvedLocale)}