Skip to content

Commit

Permalink
fix taskdraft not cleared issue
Browse files Browse the repository at this point in the history
  • Loading branch information
faaydemir committed Dec 4, 2023
1 parent 61dec49 commit d8c8fc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/state/taskEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const taskDeleteStarted = () => {

export const taskDeleteCompleted = () => {
taskEditState.mutate({
selectedTask: undefined,
isTaskEditProcessing: false,
isTaskEditVisible: false,
});
Expand Down
7 changes: 6 additions & 1 deletion src/view/page/home/parts/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,19 @@ const EditTask = () => {
};

useEffect(() => {
if (isTaskEditVisible === false) {
setTaskDraft({});
return;
}

if (!_.isEmpty(selectedTask)) {
setTaskDraft({ ...selectedTask });
setIsEdit(true);
} else {
setTaskDraft(defaultTaskDraft)
setIsEdit(false);
}
}, [selectedTask]);
}, [selectedTask, isTaskEditVisible]);

return (
<ReactModal
Expand Down

0 comments on commit d8c8fc7

Please sign in to comment.