Compare commits

...

1 Commits

Author SHA1 Message Date
Naiyuan Qing
f16164e9f9 fix(comments): defer input clearing until submit succeeds
clearContent() and setIsEmpty() were called before await onSubmit(),
causing permanent content and draft loss on network failure. Move both
to the success path, consistent with attachment and draft cleanup.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
2026-05-27 13:34:01 +08:00
2 changed files with 4 additions and 4 deletions

View File

@@ -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 {

View File

@@ -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 {