[Form lib] Add option to indicate that a validator is asynchronous #109628
Labels
enhancement
New value added to drive a business result
Feature:FormLib
Team:Kibana Management
Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Consumers of the form lib can add synchronous and asynchronous validators to their field and it works "out of the box". This has a not optimal side effect: asynchronous HTTP request are called twice.
Indeed, the form lib will first try to run all the validators synchronously. If it detects that one validators returns a
then
, it knows that it is asynchronous. It then re-run all the validations asynchronously. Which trigger a second HTTP request.We need to add an option to the validations (e.g.
isAsync: true
) which allows the consumer to tell beforehand that there is an asynchronous validation so the form lib can immediatelyawait
for the validations to run.The text was updated successfully, but these errors were encountered: