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) => {
|
renderOption={(props, option) => {
|
||||||
const { key, ...optionProps } = props;
|
const { key, ...optionProps } = props;
|
||||||
|
const hasSecondaryLabel = secondaryLabel && option[secondaryLabel] !== undefined;
|
||||||
return (
|
return (
|
||||||
<ListItem
|
<ListItem
|
||||||
key={key}
|
key={key}
|
||||||
@@ -168,9 +169,7 @@ const Search = ({
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{option[filteredBy] +
|
{option[filteredBy] +
|
||||||
(secondaryLabel && option[secondaryLabel]
|
(hasSecondaryLabel ? ` (${option[secondaryLabel]})` : "")}
|
||||||
? ` (${option[secondaryLabel]})`
|
|
||||||
: "")}
|
|
||||||
</ListItem>
|
</ListItem>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in new issue
Block a user