fix(workflow): prevent empty variable name validation error

The validation was triggering incorrectly for empty input values. Added a check to only validate non-empty values to avoid false negatives.
pull/21843/head
Mminamiyama 11 months ago
parent ecfa76cbe7
commit 2064537928

@ -145,7 +145,7 @@ const ChatVariableModal = ({
const handleVarNameChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleVarNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
replaceSpaceWithUnderscreInVarNameInput(e.target) replaceSpaceWithUnderscreInVarNameInput(e.target)
if (!checkVariableName(e.target.value)) if (!!e.target.value && !checkVariableName(e.target.value))
return return
setName(e.target.value || '') setName(e.target.value || '')
} }

@ -44,7 +44,7 @@ const VariableModal = ({
const handleVarNameChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleVarNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
replaceSpaceWithUnderscreInVarNameInput(e.target) replaceSpaceWithUnderscreInVarNameInput(e.target)
if (!checkVariableName(e.target.value)) if (!!e.target.value && !checkVariableName(e.target.value))
return return
setName(e.target.value || '') setName(e.target.value || '')
} }

Loading…
Cancel
Save