Skip to content

Commit

Permalink
fix(dropdown-list): extract expression
Browse files Browse the repository at this point in the history
  • Loading branch information
ogermain-kronos committed Jun 3, 2024
1 parent 27eec0b commit ce504da
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ export const DropdownList: VoidFunctionComponent<DropdownListProps<boolean | und
],
);

const firstSelectedOption = selectedOptions?.[0];

return (
<StyledFieldContainer
className={className}
Expand Down Expand Up @@ -516,7 +518,7 @@ export const DropdownList: VoidFunctionComponent<DropdownListProps<boolean | und
<input type="hidden" name={name} value={getValues()} data-testid="input" />
{multiselect
? <TagWrapper data-testid="tag-wrapper">{renderSelectedOptionsTags()}</TagWrapper>
: <TextWrapper>{selectedOptions?.[0]?.label ?? ''}</TextWrapper>}
: <TextWrapper>{firstSelectedOption?.label ?? ''}</TextWrapper>}
<Arrow
aria-hidden="true"
data-testid="arrow"
Expand Down

0 comments on commit ce504da

Please sign in to comment.