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:
@@ -1871,6 +1871,7 @@ export function Composer({
|
|||||||
submitIcon={submitIcon}
|
submitIcon={submitIcon}
|
||||||
isSubmitDisabled={isSubmitBusy}
|
isSubmitDisabled={isSubmitBusy}
|
||||||
isSubmitLoading={isSubmitBusy}
|
isSubmitLoading={isSubmitBusy}
|
||||||
|
preserveHeightOnSubmit={submitBehavior === "preserve-and-lock"}
|
||||||
attachments={selectedAttachments}
|
attachments={selectedAttachments}
|
||||||
cwd={cwd}
|
cwd={cwd}
|
||||||
attachmentMenuItems={attachmentMenuItems}
|
attachmentMenuItems={attachmentMenuItems}
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ export interface MessageInputProps {
|
|||||||
submitIcon?: "arrow" | "return";
|
submitIcon?: "arrow" | "return";
|
||||||
isSubmitDisabled?: boolean;
|
isSubmitDisabled?: boolean;
|
||||||
isSubmitLoading?: boolean;
|
isSubmitLoading?: boolean;
|
||||||
|
/** When true, keep the grown input height after submit (text is preserved, not cleared). */
|
||||||
|
preserveHeightOnSubmit?: boolean;
|
||||||
attachments: ComposerAttachment[];
|
attachments: ComposerAttachment[];
|
||||||
cwd: string;
|
cwd: string;
|
||||||
attachmentMenuItems: AttachmentMenuItem[];
|
attachmentMenuItems: AttachmentMenuItem[];
|
||||||
@@ -982,6 +984,7 @@ interface SendMessageContext {
|
|||||||
isAgentRunning: boolean;
|
isAgentRunning: boolean;
|
||||||
onSubmit: (payload: MessagePayload) => void;
|
onSubmit: (payload: MessagePayload) => void;
|
||||||
onMinimizeHeight: () => void;
|
onMinimizeHeight: () => void;
|
||||||
|
preserveHeightOnSubmit: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendMessageImpl(ctx: SendMessageContext): void {
|
function sendMessageImpl(ctx: SendMessageContext): void {
|
||||||
@@ -1000,7 +1003,11 @@ function sendMessageImpl(ctx: SendMessageContext): void {
|
|||||||
cwd: ctx.cwd,
|
cwd: ctx.cwd,
|
||||||
forceSend: ctx.isAgentRunning || undefined,
|
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 {
|
interface QueueMessageContext {
|
||||||
@@ -1141,6 +1148,7 @@ interface ResolvedMessageInputProps {
|
|||||||
submitIcon: "arrow" | "return";
|
submitIcon: "arrow" | "return";
|
||||||
isSubmitDisabled: boolean;
|
isSubmitDisabled: boolean;
|
||||||
isSubmitLoading: boolean;
|
isSubmitLoading: boolean;
|
||||||
|
preserveHeightOnSubmit: boolean;
|
||||||
attachments: ComposerAttachment[];
|
attachments: ComposerAttachment[];
|
||||||
cwd: string;
|
cwd: string;
|
||||||
attachmentMenuItems: AttachmentMenuItem[];
|
attachmentMenuItems: AttachmentMenuItem[];
|
||||||
@@ -1182,6 +1190,7 @@ function resolveMessageInputProps(props: MessageInputProps): ResolvedMessageInpu
|
|||||||
submitIcon: props.submitIcon ?? "arrow",
|
submitIcon: props.submitIcon ?? "arrow",
|
||||||
isSubmitDisabled: props.isSubmitDisabled ?? false,
|
isSubmitDisabled: props.isSubmitDisabled ?? false,
|
||||||
isSubmitLoading: props.isSubmitLoading ?? false,
|
isSubmitLoading: props.isSubmitLoading ?? false,
|
||||||
|
preserveHeightOnSubmit: props.preserveHeightOnSubmit ?? false,
|
||||||
attachments: props.attachments,
|
attachments: props.attachments,
|
||||||
cwd: props.cwd,
|
cwd: props.cwd,
|
||||||
attachmentMenuItems: props.attachmentMenuItems,
|
attachmentMenuItems: props.attachmentMenuItems,
|
||||||
@@ -1231,6 +1240,7 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
|||||||
submitIcon,
|
submitIcon,
|
||||||
isSubmitDisabled,
|
isSubmitDisabled,
|
||||||
isSubmitLoading,
|
isSubmitLoading,
|
||||||
|
preserveHeightOnSubmit,
|
||||||
attachments,
|
attachments,
|
||||||
cwd,
|
cwd,
|
||||||
attachmentMenuItems,
|
attachmentMenuItems,
|
||||||
@@ -1546,6 +1556,7 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
|||||||
isAgentRunning,
|
isAgentRunning,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
onMinimizeHeight: minimizeInputHeight,
|
onMinimizeHeight: minimizeInputHeight,
|
||||||
|
preserveHeightOnSubmit,
|
||||||
}),
|
}),
|
||||||
[
|
[
|
||||||
allowEmptySubmit,
|
allowEmptySubmit,
|
||||||
@@ -1555,6 +1566,7 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
|||||||
isAgentRunning,
|
isAgentRunning,
|
||||||
hasExternalContent,
|
hasExternalContent,
|
||||||
minimizeInputHeight,
|
minimizeInputHeight,
|
||||||
|
preserveHeightOnSubmit,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user