Skip to content

Commit

Permalink
fix(form): register field in the current animation frame
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel910 committed Jun 21, 2024
1 parent e6ce53a commit 3f7bb94
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/form/src/FormPresenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ export class FormPresenter<T extends GenericFormData = GenericFormData> {
const currentFieldValue = lodashGet(this.data, fieldName);
const defaultValue = field.getDefaultValue();

this.formFields.set(props.name, field);

requestAnimationFrame(() => {
runInAction(() => {
if (emptyValues.includes(currentFieldValue) && defaultValue !== undefined) {
lodashSet(this.data, fieldName, defaultValue);
}

this.formFields.set(props.name, field);
});
});
}
Expand Down

0 comments on commit 3f7bb94

Please sign in to comment.