v0.5.0
This release introduces debouncing for fields that have expensive or long-running validation. If you don't want to run validation on every key press, but you don't want to run validation on blur, then you can use the new asyncSetValidate
and asyncModifyValidate
functions to debounce validations for however long you wish. See the new async
example to see this in practice.
Major Changes
-
You can now debounce async validation on a field when using the
ModifyValidate
query, which has been updated to (optionally) take a number of milliseconds for debouncing. This lets you selectively debounce expensive validation. -
There are now new helpers called
asyncModifyValidate
,asyncSetValidate
, which let you assign n milliseconds to debounce the given field.Modify
,Validate
, andValidateAll
do not run with a debouncer. The existingmodifyValidate
andsetValidate
functions run as usual. -
There is now a new data type for result field:
FormFieldResult
. This type lets you inspect whether the field isNotValidated
,Validating
(use this to show a spinner, if you’d like),Error
, orSuccess
. The type includes instances for Functor, Apply, Applicative, Bind, etc.; prisms to access the two constructors containing data, and helper functions liketoMaybe
andfromEither
. -
Due to the new result type, the prisms for accessing a form field have been updated and renamed to
_FieldInput
,_FieldResult
, etc instead of_Input
,_Result
. This is necessary because some prisms have the same name and would cause conflicts when exported. The outer functions are unchanged, so almost all code should work as before. -
Users will probably have to update helper functions that operate on the result field because of these changes. When updating the Formless examples I just had to update a single
showError
helper function. -
The
Initialize
query is now actually used for initialization, andLoadForm
is used to load a new form remotely.