Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Form lib] Remove flat "raw" state #78589

Closed
3 tasks
sebelga opened this issue Sep 28, 2020 · 1 comment · Fixed by #80842
Closed
3 tasks

[Form lib] Remove flat "raw" state #78589

sebelga opened this issue Sep 28, 2020 · 1 comment · Fixed by #80842
Assignees
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

Comments

@sebelga
Copy link
Contributor

sebelga commented Sep 28, 2020

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() or form.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.

  • The "Out" state is the interface that we expect back from the form after going through all the serializer(s).
  • The "In" state is the interface the form is working with. (for e.g. for a _meta field which is a JSON, internally the form works with a string state for that field, but the "Out" state would be an object).

I added the possibility to type the "Out" (T) and "In" (I) in #78588

TODO

  • Update the docs to reflect those changes
    • Remove "raw" state in "raw, in, out" stage page
    • form.getFormData() does not accept any more a unflatten option
@sebelga sebelga self-assigned this Sep 28, 2020
@sebelga sebelga added enhancement New value added to drive a business result Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more labels Sep 28, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants