File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
web/components/segments/Rule Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ export type Operator = {
3434 hideValue ?: boolean
3535 warning ?: string
3636 valuePlaceholder ?: string
37+ append ?: string
38+ type ?: string
3739}
3840export type ChangeRequestSummary = {
3941 id : number
Original file line number Diff line number Diff line change @@ -76,20 +76,26 @@ const Rule: React.FC<RuleProps> = ({
7676 operator : operatorValue ?. split ( ':' ) [ 0 ] ,
7777 }
7878
79- // Clear value when changing to or from IN operator
79+ // Handle append changes first
80+ if ( prevOperator ?. append !== newOperator ?. append ) {
81+ const conditionValue = typeof condition ?. value === 'boolean' ? String ( condition . value ) : condition ?. value
82+ const cleanValue = splitIfValue ( conditionValue , prevOperator ?. append || '' ) [ 0 ]
83+ updates . value = cleanValue + ( newOperator ?. append || '' )
84+ }
85+
86+ // Clear value when changing to or from IN operator (after append handling)
8087 const isChangingToIn = operatorValue === 'IN'
8188 const isChangingFromIn = condition ?. operator === 'IN'
8289 if ( isChangingToIn || isChangingFromIn ) {
8390 updates . value = ''
8491 }
8592
93+ // Set null for hideValue operators (takes precedence over everything)
8694 if ( newOperator ?. hideValue ) {
8795 updates . value = null
88- }
89-
90- if ( prevOperator ?. append !== newOperator ?. append ) {
91- const cleanValue = splitIfValue ( condition ?. value , prevOperator ?. append ) [ 0 ]
92- updates . value = cleanValue + ( newOperator ?. append || '' )
96+ } else if ( prevOperator ?. hideValue && ! updates . hasOwnProperty ( 'value' ) ) {
97+ // When changing FROM a hideValue operator, initialize value to empty string
98+ updates . value = ''
9399 }
94100
95101 if ( shouldAutoSetIdentityKey ( operatorValue , condition . property ) ) {
You can’t perform that action at this time.
0 commit comments