Skip to content

Commit

Permalink
#70 Migrate resource select to react-hook-forms
Browse files Browse the repository at this point in the history
  • Loading branch information
ialakey committed Jun 21, 2024
1 parent 9ec8b42 commit 6161b22
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ export function useAnswerReference<R extends Resource = any, IR extends Resource
action: ActionMeta<QuestionnaireItemAnswerOption>,
) => {
if (!repeats || action.action !== 'select-option') {
onChange(selectedValue as SingleValue<QuestionnaireItemAnswerOption>);
} else if (repeats || action.action === 'select-option') {
onChange(selectedValue as MultiValue<QuestionnaireItemAnswerOption>);
if (Array.isArray(selectedValue)) {
onChange(selectedValue as MultiValue<QuestionnaireItemAnswerOption>);
} else {
onChange(selectedValue as SingleValue<QuestionnaireItemAnswerOption>);
}
}
};

Expand Down

0 comments on commit 6161b22

Please sign in to comment.