Skip to content

v0.5.0

Compare
Choose a tag to compare
@thomashoneyman thomashoneyman released this 30 Nov 06:08
2e0abc4

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, and ValidateAll do not run with a debouncer. The existing modifyValidate and setValidate functions run as usual.

  • There is now a new data type for result field: FormFieldResult. This type lets you inspect whether the field is NotValidated, Validating (use this to show a spinner, if you’d like), Error, or Success. The type includes instances for Functor, Apply, Applicative, Bind, etc.; prisms to access the two constructors containing data, and helper functions like toMaybe and fromEither.

  • 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, and LoadForm is used to load a new form remotely.