From 2e31eaadb66a2702af5cc0a62192569c25b11089 Mon Sep 17 00:00:00 2001 From: Arnaud AMBROSELLI Date: Fri, 29 Sep 2023 16:39:26 +0200 Subject: [PATCH] fix(dashboard): edit medical file --- dashboard/src/scenes/person/components/EditModal.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dashboard/src/scenes/person/components/EditModal.js b/dashboard/src/scenes/person/components/EditModal.js index 016f1a4ff3..8f557830e3 100644 --- a/dashboard/src/scenes/person/components/EditModal.js +++ b/dashboard/src/scenes/person/components/EditModal.js @@ -11,7 +11,7 @@ import { import { outOfBoundariesDate } from '../../../services/date'; import SelectTeamMultiple from '../../../components/SelectTeamMultiple'; import { currentTeamState, userState } from '../../../recoil/auth'; -import { useRecoilState, useRecoilValue } from 'recoil'; +import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'; import CustomFieldInput from '../../../components/CustomFieldInput'; import { useMemo, useState } from 'react'; import ButtonCustom from '../../../components/ButtonCustom'; @@ -31,8 +31,8 @@ export default function EditModal({ person, selectedPanel, onClose, isMedicalFil const team = useRecoilValue(currentTeamState); const [persons, setPersons] = useRecoilState(personsState); const customFieldsMedicalFile = useRecoilValue(customFieldsMedicalFileSelector); - const [allMedicalFiles, setAllMedicalFiles] = useRecoilState(medicalFileState); - const medicalFile = useMemo(() => (allMedicalFiles || []).find((m) => m.person === person._id), [allMedicalFiles, person._id]); + const setAllMedicalFiles = useSetRecoilState(medicalFileState); + const medicalFile = person.medicalFile; const customFieldsMedicalFileWithLegacyFields = useMemo(() => { const c = [...customFieldsMedicalFile];