Open-source serverless enterprise CMS. Includes a headless CMS, page builder, form builder, and file manager. Easy to customize and expand. Deploys to AWS.
This PR ensures that form fields are registered into the form as soon as the useBind is executed, within the same render cycle. Previously, form fields were registered within a requestAnimationFrame callback. In most cases, that was not an issue, until we ran into a very interesting use case, where we would call bind.onChange, and it would not be able to set the value, because the field was not yet registered into the form.
How Has This Been Tested?
Manually. Unfortunately, I was unable to simulate this bug using Jest and React Testing Library, because the bug only manifests itself on the first render cycle.
Changes
This PR ensures that form fields are registered into the form as soon as the
useBind
is executed, within the same render cycle. Previously, form fields were registered within arequestAnimationFrame
callback. In most cases, that was not an issue, until we ran into a very interesting use case, where we would callbind.onChange
, and it would not be able to set the value, because the field was not yet registered into the form.How Has This Been Tested?
Manually. Unfortunately, I was unable to simulate this bug using Jest and React Testing Library, because the bug only manifests itself on the first render cycle.