Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(comments): defer input clearing until submit succeeds (#3344)

Naiyuan Qing2af2f7b3e49e
diff --git a/packages/views/issues/components/comment-input.tsx b/packages/views/issues/components/comment-input.tsx
index a3d00e9a98..5223b9fa5b 100644
--- a/packages/views/issues/components/comment-input.tsx
+++ b/packages/views/issues/components/comment-input.tsx
@@ -77,10 +77,10 @@ function CommentInput({ issueId, onSubmit }: CommentInputProps) {
.filter((a) => content.includes(a.url))
.map((a) => a.id);
setSubmitting(true);
- editorRef.current?.clearContent();
- setIsEmpty(true);
try {
await onSubmit(content, activeIds.length > 0 ? activeIds : undefined);
+ editorRef.current?.clearContent();
+ setIsEmpty(true);
setPendingAttachments([]);
clearDraft(draftKey);
} finally {
diff --git a/packages/views/issues/components/reply-input.tsx b/packages/views/issues/components/reply-input.tsx
index a6602e13cf..4f36126adf 100644
--- a/packages/views/issues/components/reply-input.tsx
+++ b/packages/views/issues/components/reply-input.tsx
@@ -96,10 +96,10 @@ function ReplyInput({
.filter((a) => content.includes(a.url))
.map((a) => a.id);
setSubmitting(true);
- editorRef.current?.clearContent();
- setIsEmpty(true);
try {
await onSubmit(content, activeIds.length > 0 ? activeIds : undefined);
+ editorRef.current?.clearContent();
+ setIsEmpty(true);
setPendingAttachments([]);
if (draftKey) clearDraft(draftKey);
} finally {