Skip to content

Commit 5d073ee

Browse files
charlesvienjonathanlab
authored andcommitted
Do not delete prompt if workspace creation fails
1 parent eb679c4 commit 5d073ee

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

apps/twig/src/renderer/features/message-editor/tiptap/useTiptapEditor.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface UseTiptapEditorOptions {
2323
commands?: boolean;
2424
bashMode?: boolean;
2525
};
26+
clearOnSubmit?: boolean;
2627
onSubmit?: (text: string) => void;
2728
onBashCommand?: (command: string) => void;
2829
onBashModeChange?: (isBashMode: boolean) => void;
@@ -43,6 +44,7 @@ export function useTiptapEditor(options: UseTiptapEditorOptions) {
4344
autoFocus = false,
4445
context,
4546
capabilities = {},
47+
clearOnSubmit = true,
4648
onSubmit,
4749
onBashCommand,
4850
onBashModeChange,
@@ -327,10 +329,12 @@ export function useTiptapEditor(options: UseTiptapEditorOptions) {
327329
callbackRefs.current.onSubmit?.(contentToXml(content));
328330
}
329331

330-
editor.commands.clearContent();
331-
prevBashModeRef.current = false;
332-
draft.clearDraft();
333-
}, [editor, disabled, isLoading, isCloud, draft]);
332+
if (clearOnSubmit) {
333+
editor.commands.clearContent();
334+
prevBashModeRef.current = false;
335+
draft.clearDraft();
336+
}
337+
}, [editor, disabled, isLoading, isCloud, draft, clearOnSubmit]);
334338

335339
submitRef.current = submit;
336340

apps/twig/src/renderer/features/task-detail/components/TaskInputEditor.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export const TaskInputEditor = forwardRef<
8282
autoFocus: true,
8383
context: { repoPath },
8484
capabilities: { commands: false, bashMode: false },
85+
clearOnSubmit: false,
8586
onSubmit: (text) => {
8687
if (text && canSubmit) {
8788
onSubmit();

0 commit comments

Comments
 (0)