diff --git a/web/components/issues/description-input.tsx b/web/components/issues/description-input.tsx index f82627fed..d18fad6e5 100644 --- a/web/components/issues/description-input.tsx +++ b/web/components/issues/description-input.tsx @@ -22,16 +22,13 @@ export type IssueDescriptionInputProps = { issueOperations: TIssueOperations; projectId: string; issueId: string; + initialValue?: string; }; export const IssueDescriptionInput: FC = observer((props) => { - const { disabled, value, workspaceSlug, setIsSubmitting, issueId, issueOperations, projectId } = props; + const { disabled, value, workspaceSlug, setIsSubmitting, issueId, issueOperations, projectId, initialValue } = props; // states const [descriptionHTML, setDescriptionHTML] = useState(value); - const [localIssueDescription, setLocalIssueDescription] = useState({ - id: issueId, - description_html: typeof value === "string" && value != "" ? value : "

", - }); // store hooks const { mentionHighlights, mentionSuggestions } = useMention(); const { getWorkspaceBySlug } = useWorkspace(); @@ -45,16 +42,7 @@ export const IssueDescriptionInput: FC = observer((p }, [value]); useEffect(() => { - if (issueId && value) - setLocalIssueDescription({ - id: issueId, - description_html: typeof value === "string" && value != "" ? value : "

", - }); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [issueId, value]); - - useEffect(() => { - if (debouncedValue || debouncedValue === "") { + if (debouncedValue && debouncedValue !== value) { setIsSubmitting("submitted"); issueOperations .update(workspaceSlug, projectId, issueId, { description_html: debouncedValue }, false) @@ -92,9 +80,7 @@ export const IssueDescriptionInput: FC = observer((p deleteFile={fileService.getDeleteImageFunction(workspaceId)} restoreFile={fileService.getRestoreImageFunction(workspaceId)} value={descriptionHTML} - rerenderOnPropsChange={localIssueDescription} - // setShouldShowAlert={setShowAlert} - // setIsSubmitting={setIsSubmitting} + initialValue={initialValue} dragDropEnabled customClassName="min-h-[150px] shadow-sm" onChange={(description: Object, description_html: string) => { diff --git a/web/components/issues/issue-detail/inbox/main-content.tsx b/web/components/issues/issue-detail/inbox/main-content.tsx index b49c0286f..a576f6034 100644 --- a/web/components/issues/issue-detail/inbox/main-content.tsx +++ b/web/components/issues/issue-detail/inbox/main-content.tsx @@ -79,6 +79,7 @@ export const InboxIssueMainContent: React.FC = observer((props) => { issueOperations={issueOperations} disabled={!is_editable} value={issue.description_html} + initialValue={issue.description_html} /> {currentUser && ( diff --git a/web/components/issues/title-input.tsx b/web/components/issues/title-input.tsx index e18974190..55dd80b87 100644 --- a/web/components/issues/title-input.tsx +++ b/web/components/issues/title-input.tsx @@ -31,7 +31,7 @@ export const IssueTitleInput: FC = observer((props) => { }, [value]); useEffect(() => { - if (debouncedValue) { + if (debouncedValue && debouncedValue !== value) { issueOperations.update(workspaceSlug, projectId, issueId, { name: debouncedValue }, false).finally(() => { setIsSubmitting("saved"); });