From 6c94e2a157a07b4ad15fce7253ac228684f41d5c Mon Sep 17 00:00:00 2001 From: Felix <67233923+DasProffi@users.noreply.github.com> Date: Sun, 6 Aug 2023 15:48:24 +0200 Subject: [PATCH] fix: fix TaskDetails being overwritten --- pnpm-lock.yaml | 8 ++++---- tasks/components/layout/PatientDetails.tsx | 4 +++- tasks/components/layout/TaskDetailView.tsx | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 71af45c8..2a815e83 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,9 +1,5 @@ lockfileVersion: '6.0' -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - importers: .: {} @@ -11272,3 +11268,7 @@ packages: /zod@3.21.4: resolution: {integrity: sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==} + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false diff --git a/tasks/components/layout/PatientDetails.tsx b/tasks/components/layout/PatientDetails.tsx index 5d1fe2db..06a5df20 100644 --- a/tasks/components/layout/PatientDetails.tsx +++ b/tasks/components/layout/PatientDetails.tsx @@ -102,6 +102,8 @@ export const PatientDetail = ({ return
Loading PatientDetails!
} + const isShowingTask = (!!taskID || taskID === '') + return (
{isShowingSavedNotification && @@ -125,7 +127,7 @@ export const PatientDetail = ({ confirmType="negative" /> {/* taskID === '' is create and if set it's the tasks id */} - {(!!taskID || taskID === '') && ( + {isShowingTask && ( setTaskID(undefined)} diff --git a/tasks/components/layout/TaskDetailView.tsx b/tasks/components/layout/TaskDetailView.tsx index 62120db9..931f4439 100644 --- a/tasks/components/layout/TaskDetailView.tsx +++ b/tasks/components/layout/TaskDetailView.tsx @@ -123,10 +123,10 @@ export const TaskDetailView = ({ const deleteTaskMutation = useTaskDeleteMutation(onClose) useEffect(() => { - if (data) { + if (data && taskID) { setTask(data) } - }, [data]) + }, [data, taskID]) const { data: personalTaskTemplatesData,