[WEB-3803] fix: duplicate comments issue (#6893)

* fix: duplicate comments issue

* fix: refactor
This commit is contained in:
Akshita Goyal 2025-04-09 14:49:54 +05:30 committed by GitHub
parent 0a924e4824
commit 144c793e9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -50,28 +50,28 @@ export const CommentCreate: FC<TCommentCreate> = observer((props) => {
});
const onSubmit = async (formData: Partial<TIssueComment>) => {
activityOperations
.createComment(formData)
.then(async () => {
if (uploadedAssetIds.length > 0) {
if (projectId) {
await fileService.updateBulkProjectAssetsUploadStatus(workspaceSlug, projectId.toString(), entityId, {
asset_ids: uploadedAssetIds,
});
} else {
await fileService.updateBulkWorkspaceAssetsUploadStatus(workspaceSlug, entityId, {
asset_ids: uploadedAssetIds,
});
}
setUploadedAssetIds([]);
try {
await activityOperations.createComment(formData);
if (uploadedAssetIds.length > 0) {
if (projectId) {
await fileService.updateBulkProjectAssetsUploadStatus(workspaceSlug, projectId.toString(), entityId, {
asset_ids: uploadedAssetIds,
});
} else {
await fileService.updateBulkWorkspaceAssetsUploadStatus(workspaceSlug, entityId, {
asset_ids: uploadedAssetIds,
});
}
})
.finally(() => {
reset({
comment_html: "<p></p>",
});
editorRef.current?.clearEditor();
setUploadedAssetIds([]);
}
} catch (error) {
console.error(error);
} finally {
reset({
comment_html: "<p></p>",
});
editorRef.current?.clearEditor();
}
};
const commentHTML = watch("comment_html");