Skip to content

Commit

Permalink
chore: extract find method
Browse files Browse the repository at this point in the history
  • Loading branch information
arunjaindev committed Nov 25, 2024
1 parent 642226d commit 58d4f25
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -559,17 +559,18 @@ export const ChartValuesSelector = ({
const handleChange: SelectPickerProps<ChartValuesType>['onChange'] = (selectedOption) =>
handleChartValuesSelection(selectedOption.value)

const selectedOption = selectOptions
const selectOptionsFlatmap = selectOptions
.flatMap((groupedOption) => groupedOption.options)
.find(
(option) =>
getOptionValue(option) ===
getOptionValue({
// Setting label null since the getOptionValue is not consuming it
label: null,
value: chartValues,
}),
)

const selectedOption = selectOptionsFlatmap.find(
(option) =>
getOptionValue(option) ===
getOptionValue({
// Setting label null since the getOptionValue is not consuming it
label: null,
value: chartValues,
}),
)

return (
<SelectPicker<ChartValuesType, false>
Expand Down

0 comments on commit 58d4f25

Please sign in to comment.