Update custom-field-query.ts

This commit is contained in:
shamoon 2024-09-04 15:05:34 -07:00
parent bf47d0c7bb
commit 2ad2c56b4c

View File

@ -189,10 +189,9 @@ export class CustomFieldQueryAtom extends CustomFieldQueryElement {
} }
override set operator(operator: string) { override set operator(operator: string) {
if ( const newType: string = CUSTOM_FIELD_QUERY_VALUE_TYPES_BY_OPERATOR[operator]
typeof this.value !== CUSTOM_FIELD_QUERY_VALUE_TYPES_BY_OPERATOR[operator] if (typeof this.value !== newType) {
) { switch (newType) {
switch (CUSTOM_FIELD_QUERY_VALUE_TYPES_BY_OPERATOR[operator]) {
case 'string': case 'string':
this.value = '' this.value = ''
break break
@ -204,6 +203,11 @@ export class CustomFieldQueryAtom extends CustomFieldQueryElement {
this.value = null this.value = null
break break
} }
} else if (
['true', 'false'].includes(this.value as string) &&
newType === 'string'
) {
this.value = ''
} }
super.operator = operator super.operator = operator
} }