From 9ec8b42bac5738a189fdb31ffcce57c0836c3852 Mon Sep 17 00:00:00 2001 From: ialakey Date: Fri, 21 Jun 2024 12:17:59 +0200 Subject: [PATCH] #70 Migrate resource select to react-hook-forms --- .../QRFormWrapper/components/reference/hooks.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/web/src/components/QRFormWrapper/components/reference/hooks.ts b/web/src/components/QRFormWrapper/components/reference/hooks.ts index 967b77e7..11c20888 100644 --- a/web/src/components/QRFormWrapper/components/reference/hooks.ts +++ b/web/src/components/QRFormWrapper/components/reference/hooks.ts @@ -1,3 +1,4 @@ +import { useFieldController } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm'; import { parseFhirQueryExpression, QuestionItemProps, @@ -40,6 +41,8 @@ export function useAnswerReference | MultiValue, action: ActionMeta, ) => { if (!repeats || action.action !== 'select-option') { - return; + onChange(selectedValue as SingleValue); + } else if (repeats || action.action === 'select-option') { + onChange(selectedValue as MultiValue); } }; @@ -95,7 +100,7 @@ export function useAnswerReference