[Form lib] Remove flat "raw" state #78589
Labels
enhancement
New value added to drive a business result
Team:Kibana Management
Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
When building the core of the form lib, I prematurely wanted to optimize and decided to use a flat object to keep the form values. I called it the "raw" form data.
Up until the moment the consumer sent the form and asked for its data (calling
form.submit()
orform.getFormData()
), the final object was not created. This created some confusion for the consumer (when subscribing to form change he got back a flat object...), and this prevents (easily) adding types for the form data. So the micro-optimization of not having to build the final object is not worth that confusion, let's remove that concept for everyone!If a form is going to have 500+ fields maybe we should worry about optimizing the fields, but at that point maybe we should see how to improve the UX in the first place 😊
"Out" and "In" states
After removing the "raw" flat data we will still have the concept of "Out" state and "In" state.
serializer(s)
._meta
field which is a JSON, internally the form works with astring
state for that field, but the "Out" state would be anobject
).I added the possibility to type the "Out" (
T
) and "In" (I
) in #78588TODO
form.getFormData()
does not accept any more aunflatten
optionThe text was updated successfully, but these errors were encountered: