mirror of
https://github.com/makeplane/plane.git
synced 2026-02-09 07:38:52 -06:00
[WEB-1902] fix: last draft issue properties (#5110)
* fix: handleFormChange added to start and due date properties * fix: useEffect added to update localStorage when isDirty changes
This commit is contained in:
committed by
GitHub
parent
c93b826c48
commit
1a26768291
@@ -266,10 +266,13 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
.finally(() => setIAmFeelingLucky(false));
|
||||
};
|
||||
|
||||
const condition =
|
||||
(watch("name") && watch("name") !== "") || (watch("description_html") && watch("description_html") !== "<p></p>");
|
||||
|
||||
const handleFormChange = () => {
|
||||
if (!onChange) return;
|
||||
|
||||
if (isDirty && (watch("name") || watch("description_html"))) onChange(watch());
|
||||
if (isDirty && condition) onChange(watch());
|
||||
else onChange(null);
|
||||
};
|
||||
|
||||
@@ -306,6 +309,14 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
} as ISearchIssueResponse);
|
||||
}, [watch, getIssueById, getProjectById, selectedParentIssue]);
|
||||
|
||||
// executing this useEffect when isDirty changes
|
||||
useEffect(() => {
|
||||
if (!onChange) return;
|
||||
|
||||
if (isDirty && condition) onChange(watch());
|
||||
else onChange(null);
|
||||
}, [isDirty]);
|
||||
|
||||
return (
|
||||
<>
|
||||
{projectId && (
|
||||
@@ -591,7 +602,10 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
<div className="h-7">
|
||||
<DateDropdown
|
||||
value={value}
|
||||
onChange={(date) => onChange(date ? renderFormattedPayloadDate(date) : null)}
|
||||
onChange={(date) => {
|
||||
onChange(date ? renderFormattedPayloadDate(date) : null);
|
||||
handleFormChange();
|
||||
}}
|
||||
buttonVariant="border-with-text"
|
||||
maxDate={maxDate ?? undefined}
|
||||
placeholder="Start date"
|
||||
@@ -607,7 +621,10 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||
<div className="h-7">
|
||||
<DateDropdown
|
||||
value={value}
|
||||
onChange={(date) => onChange(date ? renderFormattedPayloadDate(date) : null)}
|
||||
onChange={(date) => {
|
||||
onChange(date ? renderFormattedPayloadDate(date) : null);
|
||||
handleFormChange();
|
||||
}}
|
||||
buttonVariant="border-with-text"
|
||||
minDate={minDate ?? undefined}
|
||||
placeholder="Due date"
|
||||
|
||||
Reference in New Issue
Block a user