[WEB-3803] fix: duplicate comments issue (#6893)
* fix: duplicate comments issue * fix: refactor
This commit is contained in:
parent
0a924e4824
commit
144c793e9e
1 changed files with 20 additions and 20 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue