Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async validation leads to form level re-rendering #5323

Closed
ahshum opened this issue Sep 30, 2020 · 5 comments
Closed

Async validation leads to form level re-rendering #5323

ahshum opened this issue Sep 30, 2020 · 5 comments
Labels

Comments

@ahshum
Copy link

ahshum commented Sep 30, 2020

What you were expecting:

Async validator should work as sync validator.

What happened instead:

Using async validator re-renders the form completely.

Steps to reproduce:

  1. Base on the examples/simple, edit posts/PostEdit.js
  2. Change title's TextField to
const TitleInput = (props) => {
  const asyncValidate = async (value) => {
    return "Async";
  };

  return <TextInput {...props} validate={[required(), asyncValidate]} />;
};
  1. Any changes in the form leads to completed re-rendering.

Link to Sandbox

Environment

  • React-admin version: 3.8.5
  • React version: 16.13.1
@djhi djhi added the bug label Oct 1, 2020
@djhi
Copy link
Collaborator

djhi commented Oct 1, 2020

Thanks for reporting. Indeed, we're not handling async validators here

@ahshum
Copy link
Author

ahshum commented Oct 1, 2020

I guess async validator is handled by final-form.

Besides, I would like to point out the performance issue of using async validator as I tested with pure final-form that it does not lead to form re-rendering.

@WiXSL
Copy link
Contributor

WiXSL commented Feb 23, 2021

Has this been fixed by #5623?

@djhi
Copy link
Collaborator

djhi commented Feb 23, 2021

It should have, yes

@ahshum
Copy link
Author

ahshum commented Feb 24, 2021

Thank you. It works now.

@ahshum ahshum closed this as completed Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants