1- import React from 'react'
1+ import React , { useEffect } from 'react'
22import Icon from 'components/Icon'
33import Utils from 'common/utils/utils'
44import {
@@ -67,15 +67,15 @@ const RuleConditionRow: React.FC<RuleConditionRowProps> = ({
6767 if ( rule . delete ) {
6868 return null
6969 }
70+
7071 const valuePlaceholder = operatorObj ?. hideValue
7172 ? 'Value (N/A)'
7273 : operatorObj ?. valuePlaceholder || 'Value'
7374
7475 // TODO: Move this to the parent component in next iteration
75-
7676 const ALLOWED_CONTEXT_VALUES : OptionType [ ] = [
7777 {
78- enabled : operator = == 'PERCENTAGE_SPLIT' ,
78+ disabled : operator ! == 'PERCENTAGE_SPLIT' ,
7979 label : RuleContextLabels . IDENTITY_KEY ,
8080 value : RuleContextValues . IDENTITY_KEY ,
8181 } ,
@@ -87,7 +87,7 @@ const RuleConditionRow: React.FC<RuleConditionRowProps> = ({
8787 label : RuleContextLabels . ENVIRONMENT_NAME ,
8888 value : RuleContextValues . ENVIRONMENT_NAME ,
8989 } ,
90- ] ?. filter ( ( option ) => ! ! option . enabled )
90+ ] ?. filter ( ( option ) => ! option . disabled )
9191
9292 const isValueFromContext = ! ! ALLOWED_CONTEXT_VALUES . find (
9393 ( option ) => option . value === rule . property ,
@@ -133,9 +133,9 @@ const RuleConditionRow: React.FC<RuleConditionRowProps> = ({
133133 < Select
134134 data-test = { `${ dataTest } -operator-${ ruleIndex } ` }
135135 value = { operator && find ( operators , { value : operator } ) }
136- onChange = { ( value : { value : string } ) =>
136+ onChange = { ( value : { value : string } ) => {
137137 setRuleProperty ( ruleIndex , 'operator' , value )
138- }
138+ } }
139139 options = { operators }
140140 style = { { width : '190px' } }
141141 />
0 commit comments