fix: con vars set value

This commit is contained in:
Joel 2025-08-01 17:24:53 +08:00
parent 6287e3cd9e
commit 2bd096b454
3 changed files with 6 additions and 6 deletions

View File

@ -229,7 +229,7 @@ const ConditionItem = ({
if(condition.varType === VarType.boolean) if(condition.varType === VarType.boolean)
return true return true
// eslint-disable-next-line sonarjs/prefer-single-boolean-return // eslint-disable-next-line sonarjs/prefer-single-boolean-return
if(condition.varType === VarType.arrayBoolean && [ComparisonOperator.contains, ComparisonOperator.notContains].includes(condition.comparison_operator)) if(condition.varType === VarType.arrayBoolean && [ComparisonOperator.contains, ComparisonOperator.notContains].includes(condition.comparison_operator!))
return true return true
return false return false
}, [condition]) }, [condition])

View File

@ -11,8 +11,8 @@ import cn from '@/utils/classnames'
type Props = { type Props = {
className?: string className?: string
list: any[] list: boolean[]
onChange: (list: string[]) => void onChange: (list: boolean[]) => void
} }
const ArrayValueList: FC<Props> = ({ const ArrayValueList: FC<Props> = ({
@ -23,7 +23,7 @@ const ArrayValueList: FC<Props> = ({
const { t } = useTranslation() const { t } = useTranslation()
const handleChange = useCallback((index: number) => { const handleChange = useCallback((index: number) => {
return (value: string) => { return (value: boolean) => {
const newList = produce(list, (draft: any[]) => { const newList = produce(list, (draft: any[]) => {
draft[index] = value draft[index] = value
}) })
@ -42,7 +42,7 @@ const ArrayValueList: FC<Props> = ({
const handleItemAdd = useCallback(() => { const handleItemAdd = useCallback(() => {
const newList = produce(list, (draft: any[]) => { const newList = produce(list, (draft: any[]) => {
draft.push('false') draft.push(false)
}) })
onChange(newList) onChange(newList)
}, [list, onChange]) }, [list, onChange])

View File

@ -150,7 +150,7 @@ const ChatVariableModal = ({
if(v === ChatVarType.Boolean) if(v === ChatVarType.Boolean)
setValue(true) setValue(true)
if (v === ChatVarType.ArrayBoolean) if (v === ChatVarType.ArrayBoolean)
setValue([true]) setValue([false])
setType(v) setType(v)
} }