π₯π₯π₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
fix: workitem description input inital load (#8617)
Anmol Singh Bhatiadbe059b7b526
diff --git a/apps/web/core/components/editor/rich-text/description-input/root.tsx b/apps/web/core/components/editor/rich-text/description-input/root.tsxindex 86c9741eed..fefa49f9cc 100644--- a/apps/web/core/components/editor/rich-text/description-input/root.tsx+++ b/apps/web/core/components/editor/rich-text/description-input/root.tsx@@ -119,6 +119,8 @@ export const DescriptionInput = observer(function DescriptionInput(props: Props)});// ref to track if there are unsaved changesconst hasUnsavedChanges = useRef(false);+ // ref to track last saved content (to skip onChange when content hasn't actually changed)+ const lastSavedContent = useRef(initialValue?.trim() === "" ? "<p></p>" : (initialValue ?? "<p></p>"));// store hooksconst { getWorkspaceBySlug } = useWorkspace();const { uploadEditorAsset, duplicateEditorAsset } = useEditorAsset();@@ -139,6 +141,8 @@ export const DescriptionInput = observer(function DescriptionInput(props: Props)const handleDescriptionFormSubmit = useCallback(async (formData: TFormData) => {await onSubmit(formData.description_html, formData.isMigrationUpdate);+ // Update lastSavedContent after successful save+ lastSavedContent.current = formData.description_html;},[onSubmit]);@@ -146,14 +150,17 @@ export const DescriptionInput = observer(function DescriptionInput(props: Props)// reset form valuesuseEffect(() => {if (!entityId) return;+ const normalizedValue = initialValue?.trim() === "" ? "<p></p>" : (initialValue ?? "<p></p>");+ // Update last saved content when entity/initialValue changes+ lastSavedContent.current = normalizedValue;reset({id: entityId,- description_html: initialValue?.trim() === "" ? "<p></p>" : (initialValue ?? "<p></p>"),+ description_html: normalizedValue,isMigrationUpdate: false,});setLocalDescription({id: entityId,- description_html: initialValue?.trim() === "" ? "<p></p>" : (initialValue ?? "<p></p>"),+ description_html: normalizedValue,isMigrationUpdate: false,});// Reset unsaved changes flag when form is reset@@ -219,6 +226,8 @@ export const DescriptionInput = observer(function DescriptionInput(props: Props)projectId={projectId}dragDropEnabledonChange={(_description, description_html, options) => {+ // Skip if content hasn't actually changed (handles editor normalization on init)+ if (description_html === lastSavedContent.current) return;setIsSubmitting("submitting");onChange(description_html);setValue("isMigrationUpdate", options?.isMigrationUpdate ?? false);