Moved the evaluation in start of the render option execution.
This commit is contained in:
1 parent
5825151b28
commit
e0e2cec386
1 file changed
+2
-3
@@ -154,6 +154,7 @@ const Search = ({
|
||||
}}
|
||||
renderOption={(props, option) => {
|
||||
const { key, ...optionProps } = props;
|
||||
const hasSecondaryLabel = secondaryLabel && option[secondaryLabel] !== undefined;
|
||||
return (
|
||||
<ListItem
|
||||
key={key}
|
||||
@@ -168,9 +169,7 @@ const Search = ({
|
||||
}
|
||||
>
|
||||
{option[filteredBy] +
|
||||
(secondaryLabel && option[secondaryLabel]
|
||||
? ` (${option[secondaryLabel]})`
|
||||
: "")}
|
||||
(hasSecondaryLabel ? ` (${option[secondaryLabel]})` : "")}
|
||||
</ListItem>
|
||||
);
|
||||
}}
|
||||
|
||||
Reference in new issue
Block a user