Skip to content

Commit

Permalink
userProp function builder: quote param
Browse files Browse the repository at this point in the history
  • Loading branch information
SteRiccio committed Oct 14, 2024
1 parent 90131b9 commit dcb9c64
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions webapp/components/expression/nodes/call/callUserPropEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ export const CallUserPropEditor = (props) => {

const [value, setValue] = useState(initialValue)

const createFunctionCall = useCallback(
(valueUpdated) =>
Expression.newCall({ callee: Expression.functionNames.userProp, params: [Expression.newLiteral(valueUpdated)] }),
[]
)

const onValueChange = useCallback((valueUpdated) => setValue(valueUpdated), [])
const createFunctionCall = useCallback((valueUpdated) => {
const param = Expression.newLiteral(StringUtils.quote(valueUpdated))
return Expression.newCall({ callee: Expression.functionNames.userProp, params: [param] })
}, [])

const onConfirm = useCallback(() => {
if (Objects.isNotEmpty(value)) {
Expand All @@ -36,7 +33,7 @@ export const CallUserPropEditor = (props) => {
return (
<div className="function-editor">
<FormItem label={i18n.t('extraProp.label')}>
<Input onChange={onValueChange} textTransformFunction={StringUtils.normalizeName} value={value} />
<Input onChange={setValue} textTransformFunction={StringUtils.normalizeName} value={value} />
</FormItem>
<Button disabled={Objects.isEmpty(value)} label="common.ok" onClick={onConfirm} />
</div>
Expand Down

0 comments on commit dcb9c64

Please sign in to comment.