From 17e5663e81a88606b27bd9731c65574b09d45d7e Mon Sep 17 00:00:00 2001 From: sriram veeraghanta Date: Mon, 19 Feb 2024 12:54:45 +0530 Subject: [PATCH] fix: description autosave fixes --- web/components/issues/description-input.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/web/components/issues/description-input.tsx b/web/components/issues/description-input.tsx index 8e0e47ae9..86ef898c0 100644 --- a/web/components/issues/description-input.tsx +++ b/web/components/issues/description-input.tsx @@ -38,23 +38,22 @@ export const IssueDescriptionInput: FC = observer((p const workspaceId = getWorkspaceBySlug(workspaceSlug)?.id as string; useEffect(() => { - if (value) setDescriptionHTML(value); + setDescriptionHTML(value); }, [value]); useEffect(() => { if (debouncedValue && debouncedValue !== value) { - setIsSubmitting("submitted"); issueOperations .update(workspaceSlug, projectId, issueId, { description_html: debouncedValue }, false) .finally(() => { - setIsSubmitting("saved"); + setIsSubmitting("submitted"); }); } // DO NOT Add more dependencies here. It will cause multiple requests to be sent. // eslint-disable-next-line react-hooks/exhaustive-deps }, [debouncedValue]); - if (!descriptionHTML && descriptionHTML !== "") { + if (!descriptionHTML) { return ( @@ -79,13 +78,13 @@ export const IssueDescriptionInput: FC = observer((p uploadFile={fileService.getUploadFileFunction(workspaceSlug)} deleteFile={fileService.getDeleteImageFunction(workspaceId)} restoreFile={fileService.getRestoreImageFunction(workspaceId)} - value={descriptionHTML} + value={descriptionHTML === "" ? "

" : descriptionHTML} initialValue={initialValue} dragDropEnabled customClassName="min-h-[150px] shadow-sm" onChange={(description: Object, description_html: string) => { setIsSubmitting("submitting"); - setDescriptionHTML(description_html); + setDescriptionHTML(description_html === "" ? "

" : description_html); }} mentionSuggestions={mentionSuggestions} mentionHighlights={mentionHighlights}