Skip to content

Commit

Permalink
fix(TDC-7476/form): check onFinish and onChange before invoking for t…
Browse files Browse the repository at this point in the history
…he Text component (#5297)
  • Loading branch information
hbhong authored Apr 30, 2024
1 parent 54230de commit eb201ac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-elephants-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@talend/react-forms": patch
---

fix: check onFinish and onChange before invoking for the Text component
12 changes: 10 additions & 2 deletions packages/forms/src/UIForm/fields/Text/Text.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,16 @@ export default function Text(props) {
autoComplete,
autoFocus,
disabled: disabled || valueIsUpdating,
onBlur: event => onFinish(event, { schema }),
onChange: event => onChange(event, { schema, value: convertValue(type, event.target.value) }),
onBlur: event => {
if (onFinish) {
onFinish(event, { schema });
}
},
onChange: event => {
if (onChange) {
onChange(event, { schema, value: convertValue(type, event.target.value) });
}
},
placeholder,
readOnly,
type,
Expand Down

0 comments on commit eb201ac

Please sign in to comment.