File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
src/components/v2/values/chartValuesDiff Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ import {
30
30
GitOpsAuthModeType ,
31
31
SelectPicker ,
32
32
SelectPickerOptionType ,
33
- getSelectPickerOptionByValue ,
33
+ SelectPickerProps ,
34
34
} from '@devtron-labs/devtron-fe-common-lib'
35
35
import Tippy from '@tippyjs/react'
36
36
import { ReactComponent as Error } from '../../../../assets/icons/ic-warning.svg'
@@ -559,16 +559,26 @@ export const ChartValuesSelector = ({
559
559
)
560
560
}
561
561
562
- const selectedOption = getSelectPickerOptionByValue ( selectOptions , chartValues , null )
562
+ const getOptionValue : SelectPickerProps < ChartValuesType > [ 'getOptionValue' ] = ( option ) =>
563
+ `${ option . value . id } ${ option . value . kind } `
564
+
565
+ const handleChange : SelectPickerProps < ChartValuesType > [ 'onChange' ] = ( selectedOption ) =>
566
+ handleChartValuesSelection ( selectedOption . value )
567
+
568
+ const selectedOption = selectOptions . flatMap ( groupedOption => groupedOption . options ) . find ( option => getOptionValue ( option ) === getOptionValue ( {
569
+ // Setting label null since the getOptionValue is not consuming it
570
+ label : null ,
571
+ value : chartValues
572
+ } ) )
563
573
564
574
return (
565
575
< SelectPicker < ChartValuesType , false >
566
576
inputId = "chart-values-selector"
567
577
options = { selectOptions }
568
578
renderMenuListFooter = { renderMenuListFooter }
569
- getOptionValue = { ( option ) => ` ${ option . value . id } ${ option . value . kind } ` }
579
+ getOptionValue = { getOptionValue }
570
580
label = "Chart Values"
571
- onChange = { ( selectedOption ) => handleChartValuesSelection ( selectedOption . value ) }
581
+ onChange = { handleChange }
572
582
value = { selectedOption }
573
583
/>
574
584
)
You can’t perform that action at this time.
0 commit comments