fix: infinity loader in the issue description in issue peek overview and issue detail page (#3656)

This commit is contained in:
guru_sainath 2024-02-14 12:46:52 +05:30 committed by GitHub
parent 83bf28bb83
commit fb4cffdd1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,7 +13,6 @@ import { TIssueOperations } from "./issue-detail";
import { FileService } from "services/file.service"; import { FileService } from "services/file.service";
import { useMention, useWorkspace } from "hooks/store"; import { useMention, useWorkspace } from "hooks/store";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { isNil } from "lodash";
export interface IssueDescriptionFormValues { export interface IssueDescriptionFormValues {
name: string; name: string;
@ -79,13 +78,13 @@ export const IssueDescriptionForm: FC<IssueDetailsProps> = observer((props) => {
}, [issue.id]); // TODO: verify the exhaustive-deps warning }, [issue.id]); // TODO: verify the exhaustive-deps warning
useEffect(() => { useEffect(() => {
if (issue.description_html) { if (["", undefined, null].includes(localIssueDescription.description_html)) {
setLocalIssueDescription((state) => { setLocalIssueDescription((state) => {
if (!isNil(state.description_html)) return state; if (!["", undefined, null].includes(state.description_html)) return state;
return { id: issue.id, description_html: issue.description_html }; return { id: issue.id, description_html: issue.description_html || "<p></p>" };
}); });
} }
}, [issue.description_html]); }, [issue.description_html, localIssueDescription.description_html, issue.id]);
const handleDescriptionFormSubmit = useCallback( const handleDescriptionFormSubmit = useCallback(
async (formData: Partial<TIssue>) => { async (formData: Partial<TIssue>) => {
@ -177,7 +176,7 @@ export const IssueDescriptionForm: FC<IssueDetailsProps> = observer((props) => {
</div> </div>
<span>{errors.name ? errors.name.message : null}</span> <span>{errors.name ? errors.name.message : null}</span>
<div className="relative"> <div className="relative">
{issue.description_html ? ( {localIssueDescription.description_html ? (
<Controller <Controller
name="description_html" name="description_html"
control={control} control={control}