The current version of Formless has support for effectful validation on fields. However, if that validation is expensive and you don’t want to run it on every key press, then you’re stuck only validating on a blur event (or making a complex workaround). In addition, there’s no way to cancel a long-running validation if the input has changed since it began. Finally, there’s no indication as to whether a validation is currently running, so no way to display a loading spinner or something like that based on the field state.
I’ve put together an update to the library that solves each of these problems. However, I don’t have this use case myself and may have missed some edge cases. To get a few more eyes on this, I’ve opened a PR here:
You can see the new behavior in action in the new async
example. It looks like this:
I’ll leave this PR open for a while to gather any constructive criticism or feedback; if no one seems to have an issue then I’ll go ahead and merge and release 0.5.0.