From 77a043b14106878970289689c96caf521281098d Mon Sep 17 00:00:00 2001 From: sriram veeraghanta Date: Fri, 1 Sep 2023 11:49:07 +0530 Subject: [PATCH] fix: commenting fixes --- .../peek-overview/comment-detail-card.tsx | 27 ++++----------- .../issues/peek-overview/header.tsx | 2 +- .../issues/peek-overview/issue-activity.tsx | 2 +- apps/space/components/tiptap/index.tsx | 15 ++++++--- apps/space/store/issue_details.ts | 33 +++++++------------ 5 files changed, 31 insertions(+), 48 deletions(-) diff --git a/apps/space/components/issues/peek-overview/comment-detail-card.tsx b/apps/space/components/issues/peek-overview/comment-detail-card.tsx index 9b2a13082..f3a9e6834 100644 --- a/apps/space/components/issues/peek-overview/comment-detail-card.tsx +++ b/apps/space/components/issues/peek-overview/comment-detail-card.tsx @@ -21,43 +21,29 @@ type Props = { export const CommentCard: React.FC = observer((props) => { const { comment, workspaceSlug } = props; // store - const { user: userStore, issue: issueStore, issueDetails: issueDetailStore } = useMobxStore(); + const { user: userStore, issueDetails: issueDetailStore } = useMobxStore(); // states const [isEditing, setIsEditing] = useState(false); const { formState: { isSubmitting }, handleSubmit, - setFocus, control, } = useForm({ defaultValues: { comment_html: comment.comment_html }, }); - const handleDelete = async () => { + const handleDelete = () => { if (!workspaceSlug || !issueDetailStore.peekId) return; - - await issueDetailStore.deleteIssueComment(workspaceSlug, comment.project, issueDetailStore.peekId, comment.id); + issueDetailStore.deleteIssueComment(workspaceSlug, comment.project, issueDetailStore.peekId, comment.id); }; const handleCommentUpdate = async (formData: Comment) => { if (!workspaceSlug || !issueDetailStore.peekId) return; - - console.log("formData", formData); - const response = await issueDetailStore.updateIssueComment( - workspaceSlug, - comment.project, - issueDetailStore.peekId, - comment.id, - formData - ); + issueDetailStore.updateIssueComment(workspaceSlug, comment.project, issueDetailStore.peekId, comment.id, formData); setIsEditing(false); }; - useEffect(() => { - isEditing && setFocus("comment_html"); - }, [isEditing, setFocus]); - return (
@@ -133,6 +119,7 @@ export const CommentCard: React.FC = observer((props) => {
+ {comment.comment_html} = observer((props) => {