Skip to content

only one error is shown at a time when calling validate #2

@vemoo

Description

@vemoo

See: https://codesandbox.io/s/charming-feistel-4ih65?file=/src/App.tsx
You have to click submit two times for both errors to appear.

I think the issue is that here

changed =
changed ||
this.setError(
key,
errors[key] as any,
notifyChild,
false, // Will call updateParentErrors by itself after all values have been copied, see 3 lines down
false // Will call fireAnyListener by itself after all values have been copied, see 3 lines down
);
if changed is true setError is not called.

I guess it's like this to avoid setting all errors when one field changes. One option I can think of is for it to behave differently if it's called from validate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions