Skip to content

Commit

Permalink
fix: Prevent blur event from having value of out sync
Browse files Browse the repository at this point in the history
  • Loading branch information
vsgoulart committed Feb 16, 2024
1 parent 87a000d commit d9ea677
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/form-js-viewer/src/render/components/FormField.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,16 @@ export function FormField(props) {

const onBlur = useCallback(() => {

const value = get(data, valuePath);

if (initialValidationTrigger) {
setInitialValidationTrigger(false);
viewerCommands.updateFieldValidation(field, value, indexes);
}

eventBus.fire('formField.blur', { formField: field });

}, [ eventBus, field, indexes, value, viewerCommands, initialValidationTrigger ]);
}, [ eventBus, field, indexes, viewerCommands, initialValidationTrigger, data, valuePath ]);

const onFocus = useCallback(() => {
eventBus.fire('formField.focus', { formField: field });
Expand Down

0 comments on commit d9ea677

Please sign in to comment.