From 5825151b28700360fc7901c70eee02a96d067124 Mon Sep 17 00:00:00 2001 From: Owaise Imdad Date: Sat, 15 Mar 2025 14:46:53 +0530 Subject: [PATCH 1/2] fixed the check for the type or label key in the options send in search component. --- src/Components/Inputs/Search/index.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Components/Inputs/Search/index.jsx b/src/Components/Inputs/Search/index.jsx index 647af874a..9e08a0dc2 100644 --- a/src/Components/Inputs/Search/index.jsx +++ b/src/Components/Inputs/Search/index.jsx @@ -167,7 +167,10 @@ const Search = ({ : {} } > - {option[filteredBy] + (secondaryLabel ? ` (${option[secondaryLabel]})` : "")} + {option[filteredBy] + + (secondaryLabel && option[secondaryLabel] + ? ` (${option[secondaryLabel]})` + : "")} ); }} From e0e2cec386464de1f210efc39b727733326ddc1f Mon Sep 17 00:00:00 2001 From: Owaise Imdad Date: Sat, 15 Mar 2025 22:31:15 +0530 Subject: [PATCH 2/2] Moved the evaluation in start of the render option execution. --- src/Components/Inputs/Search/index.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Components/Inputs/Search/index.jsx b/src/Components/Inputs/Search/index.jsx index 9e08a0dc2..a3b75161c 100644 --- a/src/Components/Inputs/Search/index.jsx +++ b/src/Components/Inputs/Search/index.jsx @@ -154,6 +154,7 @@ const Search = ({ }} renderOption={(props, option) => { const { key, ...optionProps } = props; + const hasSecondaryLabel = secondaryLabel && option[secondaryLabel] !== undefined; return ( {option[filteredBy] + - (secondaryLabel && option[secondaryLabel] - ? ` (${option[secondaryLabel]})` - : "")} + (hasSecondaryLabel ? ` (${option[secondaryLabel]})` : "")} ); }}