fix: inbox issue initial data load (#3693)

* fix: inbox issue initial data load

* chore: removed unnecessary comments
This commit is contained in:
sriram veeraghanta 2024-02-19 00:17:31 +05:30 committed by GitHub
parent ce9ed6b25e
commit 261013b794
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 19 deletions

View File

@ -22,16 +22,13 @@ export type IssueDescriptionInputProps = {
issueOperations: TIssueOperations;
projectId: string;
issueId: string;
initialValue?: string;
};
export const IssueDescriptionInput: FC<IssueDescriptionInputProps> = 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 : "<p></p>",
});
// store hooks
const { mentionHighlights, mentionSuggestions } = useMention();
const { getWorkspaceBySlug } = useWorkspace();
@ -45,16 +42,7 @@ export const IssueDescriptionInput: FC<IssueDescriptionInputProps> = observer((p
}, [value]);
useEffect(() => {
if (issueId && value)
setLocalIssueDescription({
id: issueId,
description_html: typeof value === "string" && value != "" ? value : "<p></p>",
});
// 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<IssueDescriptionInputProps> = 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) => {

View File

@ -79,6 +79,7 @@ export const InboxIssueMainContent: React.FC<Props> = observer((props) => {
issueOperations={issueOperations}
disabled={!is_editable}
value={issue.description_html}
initialValue={issue.description_html}
/>
{currentUser && (

View File

@ -31,7 +31,7 @@ export const IssueTitleInput: FC<IssueTitleInputProps> = observer((props) => {
}, [value]);
useEffect(() => {
if (debouncedValue) {
if (debouncedValue && debouncedValue !== value) {
issueOperations.update(workspaceSlug, projectId, issueId, { name: debouncedValue }, false).finally(() => {
setIsSubmitting("saved");
});