From ebfa41b10bd4d9d0762f9cc42233cd65a55a34ee Mon Sep 17 00:00:00 2001 From: dukenv0307 <129500732+dukenv0307@users.noreply.github.com> Date: Thu, 20 Jul 2023 14:42:25 +0700 Subject: [PATCH] Revert "fix: The title field is cleared when the Confirm task button is pressed" --- src/libs/actions/Task.js | 2 ++ src/pages/tasks/NewTaskPage.js | 12 ------------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index 760d99568752..b3dd76a38d78 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -203,6 +203,8 @@ function createTaskAndNavigate(parentReportID, title, description, assignee, ass {optimisticData, successData, failureData}, ); + clearOutTaskInfo(); + Navigation.dismissModal(optimisticTaskReport.reportID); } diff --git a/src/pages/tasks/NewTaskPage.js b/src/pages/tasks/NewTaskPage.js index 3e9cbb4dfdeb..01a9e2e94dc1 100644 --- a/src/pages/tasks/NewTaskPage.js +++ b/src/pages/tasks/NewTaskPage.js @@ -68,7 +68,6 @@ function NewTaskPage(props) { const [shareDestination, setShareDestination] = React.useState({}); const [errorMessage, setErrorMessage] = React.useState(''); const [parentReport, setParentReport] = React.useState({}); - const shouldClearOutTaskInfoOnUnmount = React.useRef(false); const isAllowedToCreateTask = useMemo(() => _.isEmpty(parentReport) || ReportUtils.isAllowedToComment(parentReport), [parentReport]); @@ -102,16 +101,6 @@ function NewTaskPage(props) { } }, [props]); - useEffect( - () => () => { - if (!shouldClearOutTaskInfoOnUnmount.current) { - return; - } - Task.clearOutTaskInfo(); - }, - [], - ); - // On submit, we want to call the createTask function and wait to validate // the response function onSubmit() { @@ -130,7 +119,6 @@ function NewTaskPage(props) { return; } - shouldClearOutTaskInfoOnUnmount.current = true; Task.createTaskAndNavigate(parentReport.reportID, props.task.title, props.task.description, props.task.assignee, props.task.assigneeAccountID); }