diff --git a/web/core/components/inbox/content/issue-root.tsx b/web/core/components/inbox/content/issue-root.tsx index 87c8ae6d2c..3855502e93 100644 --- a/web/core/components/inbox/content/issue-root.tsx +++ b/web/core/components/inbox/content/issue-root.tsx @@ -67,7 +67,7 @@ export const InboxIssueMainContent: React.FC = observer((props) => { }, update: async (_workspaceSlug: string, _projectId: string, _issueId: string, data: Partial) => { try { - await inboxIssue.updateIssue(data); + await inboxIssue.updateIssue({ ...data, id: _issueId }); captureIssueEvent({ eventName: "Inbox issue updated", payload: { ...data, state: "SUCCESS", element: "Inbox" }, diff --git a/web/core/components/issues/description-input.tsx b/web/core/components/issues/description-input.tsx index 8c18618c50..7f8ce330f4 100644 --- a/web/core/components/issues/description-input.tsx +++ b/web/core/components/issues/description-input.tsx @@ -59,12 +59,12 @@ export const IssueDescriptionInput: FC = observer((p }); const handleDescriptionFormSubmit = useCallback( - async (formData: Partial) => { - await issueOperations.update(workspaceSlug, projectId, issueId, { + async (formData: Partial, _issueId: string) => { + await issueOperations.update(workspaceSlug, projectId, _issueId, { description_html: formData.description_html ?? "

", }); }, - [workspaceSlug, projectId, issueId, issueOperations] + [workspaceSlug, projectId, issueOperations] ); const { getWorkspaceBySlug } = useWorkspace(); @@ -84,14 +84,17 @@ export const IssueDescriptionInput: FC = observer((p }); }, [initialValue, issueId, reset]); - // ADDING handleDescriptionFormSubmit TO DEPENDENCY ARRAY PRODUCES ADVERSE EFFECTS - // TODO: Verify the exhaustive-deps warning - // eslint-disable-next-line react-hooks/exhaustive-deps + const debouncedHandleDescriptionFormSubmit = debounce(async (data: Partial, _issueId: string) => { + await handleDescriptionFormSubmit(data, _issueId); + setIsSubmitting("submitted"); + }, 1500); + const debouncedFormSave = useCallback( - debounce(async () => { - handleSubmit(handleDescriptionFormSubmit)().finally(() => setIsSubmitting("submitted")); - }, 1500), - [handleSubmit, issueId] + (_issueId: string) => + handleSubmit((data) => { + debouncedHandleDescriptionFormSubmit(data, _issueId); + })(), + [debouncedHandleDescriptionFormSubmit, handleSubmit] ); return ( @@ -113,7 +116,7 @@ export const IssueDescriptionInput: FC = observer((p onChange={(_description: object, description_html: string) => { setIsSubmitting("submitting"); onChange(description_html); - debouncedFormSave(); + debouncedFormSave(issueId); }} placeholder={ placeholder ? placeholder : (isFocused, value) => getDescriptionPlaceholder(isFocused, value) diff --git a/web/core/store/inbox/inbox-issue.store.ts b/web/core/store/inbox/inbox-issue.store.ts index 8d33fddeec..3c88557a95 100644 --- a/web/core/store/inbox/inbox-issue.store.ts +++ b/web/core/store/inbox/inbox-issue.store.ts @@ -151,12 +151,12 @@ export class InboxIssueStore implements IInboxIssueStore { updateIssue = async (issue: Partial) => { const inboxIssue = clone(this.issue); try { - if (!this.issue.id) return; + if (!issue.id) return; Object.keys(issue).forEach((key) => { const issueKey = key as keyof TIssue; set(this.issue, issueKey, issue[issueKey]); }); - await this.inboxIssueService.updateIssue(this.workspaceSlug, this.projectId, this.issue.id, issue); + await this.inboxIssueService.updateIssue(this.workspaceSlug, this.projectId, issue.id, issue); // fetching activity this.fetchIssueActivity(); } catch {