Keep new-workspace composer expanded after submit

The new-workspace composer uses preserve-and-lock: it keeps the typed
text through workspace creation so it survives a failure. But the input
minimized its height on every submit, collapsing a multi-line draft to
one line while the text and loading spinner remained — clipped and ugly.

Gate the height-minimize on the same condition that clears the text, so
the box only collapses when the text actually goes away (agent panel),
not when it's preserved (new-workspace).
This commit is contained in:
Mohamed Boudra
2026-06-18 13:41:22 +07:00
parent de84c8f179
commit 1250f5cf4f
2 changed files with 14 additions and 1 deletions
+1
View File
@@ -1871,6 +1871,7 @@ export function Composer({
submitIcon={submitIcon}
isSubmitDisabled={isSubmitBusy}
isSubmitLoading={isSubmitBusy}
preserveHeightOnSubmit={submitBehavior === "preserve-and-lock"}
attachments={selectedAttachments}
cwd={cwd}
attachmentMenuItems={attachmentMenuItems}
+13 -1
View File
@@ -94,6 +94,8 @@ export interface MessageInputProps {
submitIcon?: "arrow" | "return";
isSubmitDisabled?: boolean;
isSubmitLoading?: boolean;
/** When true, keep the grown input height after submit (text is preserved, not cleared). */
preserveHeightOnSubmit?: boolean;
attachments: ComposerAttachment[];
cwd: string;
attachmentMenuItems: AttachmentMenuItem[];
@@ -982,6 +984,7 @@ interface SendMessageContext {
isAgentRunning: boolean;
onSubmit: (payload: MessagePayload) => void;
onMinimizeHeight: () => void;
preserveHeightOnSubmit: boolean;
}
function sendMessageImpl(ctx: SendMessageContext): void {
@@ -1000,7 +1003,11 @@ function sendMessageImpl(ctx: SendMessageContext): void {
cwd: ctx.cwd,
forceSend: ctx.isAgentRunning || undefined,
});
ctx.onMinimizeHeight();
// When the host preserves and locks the composer (e.g. new-workspace creation),
// the text stays put — collapsing the height would clip it. Keep it grown.
if (!ctx.preserveHeightOnSubmit) {
ctx.onMinimizeHeight();
}
}
interface QueueMessageContext {
@@ -1141,6 +1148,7 @@ interface ResolvedMessageInputProps {
submitIcon: "arrow" | "return";
isSubmitDisabled: boolean;
isSubmitLoading: boolean;
preserveHeightOnSubmit: boolean;
attachments: ComposerAttachment[];
cwd: string;
attachmentMenuItems: AttachmentMenuItem[];
@@ -1182,6 +1190,7 @@ function resolveMessageInputProps(props: MessageInputProps): ResolvedMessageInpu
submitIcon: props.submitIcon ?? "arrow",
isSubmitDisabled: props.isSubmitDisabled ?? false,
isSubmitLoading: props.isSubmitLoading ?? false,
preserveHeightOnSubmit: props.preserveHeightOnSubmit ?? false,
attachments: props.attachments,
cwd: props.cwd,
attachmentMenuItems: props.attachmentMenuItems,
@@ -1231,6 +1240,7 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
submitIcon,
isSubmitDisabled,
isSubmitLoading,
preserveHeightOnSubmit,
attachments,
cwd,
attachmentMenuItems,
@@ -1546,6 +1556,7 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
isAgentRunning,
onSubmit,
onMinimizeHeight: minimizeInputHeight,
preserveHeightOnSubmit,
}),
[
allowEmptySubmit,
@@ -1555,6 +1566,7 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
isAgentRunning,
hasExternalContent,
minimizeInputHeight,
preserveHeightOnSubmit,
],
);