Skip to content

Imperative api reset() caused form onChange event fired for each field. #543

@huangc8606

Description

@huangc8606

For example I have a form with 3 input fields, then call formsy.reset({}), onChange event will be fired 3 times(each field will trigger one onChange event on Formsy component), so if I have 10 fields, onChange will be fired 10 times if I use reset function. And I believe this reset process should be batched and fire onChange event only after all fields' value are updated.
https://github.com/formsy/formsy-react/blob/master/src/Formsy.ts#L243

I added below if you click "Reset Model" you could see 3 lines output.
https://codesandbox.io/s/react-playground-6m7if?file=/index.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions