[Form lib] Fix issue where serializer on fields are called on every change#75166
Merged
sebelga merged 7 commits intoelastic:masterfrom Aug 18, 2020
Conversation
We want to have the guarantee that when the serializers are called, the form is valid (all the fields value are valid). This would prevent for example a serializer to execute a JSON.parse() on a string that is not valid JSON.
Contributor
|
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
jloleysens
approved these changes
Aug 18, 2020
Contributor
jloleysens
left a comment
There was a problem hiding this comment.
@sebelga great work! 🍻
I tested with ingest processor forms locally and they are working as expected.
Contributor
Author
|
@elasticmachine merge upstream |
Contributor
💚 Build SucceededBuild metricsasync chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
Contributor
Author
|
Thanks for the review @jloleysens ! |
gmmorris
added a commit
to gmmorris/kibana
that referenced
this pull request
Aug 18, 2020
* master: Skip failing test in CI (elastic#75266) [Task Manager] time out work when it overruns in poller (elastic#74980) [Drilldowns] misc improvements & fixes (elastic#75276) Small README note on bumping memory for builds (elastic#75247) [Security Solution][Detections] Adds exception modal tests (elastic#74596) [Dashboard] Sample data link does not work (elastic#75262) [Dashboard First] Unlink from Library Action With ReferenceOrValueEmbeddable (elastic#74905) [Form lib] Fix issue where serializer on fields are called on every change (elastic#75166) convert processor labels to sentence case (elastic#75278) [Monaco] Refactor the way XJSON grammar checker gets registered (elastic#75160) Clarify no documents error message when filtering by is_training (elastic#75227) [Lens] Fix crash when two layers xychart switches to pie (elastic#75267) [Observability Homepage] Fix console error because of side effect (elastic#75258) [Usage Collection] Add `legacy=true` option to the /api/stats request in the docs (elastic#75146) [ML] Functional tests - re-activate DFA test suites (elastic#75257) GS providers improvements (elastic#75174) [Visualize] First version of by-value visualize editor (elastic#72256)
gmmorris
added a commit
to gmmorris/kibana
that referenced
this pull request
Aug 19, 2020
…emove-header * saved-objects/version-on-create: (59 commits) remove version when loading sample data omit version from SO import/export Skip failing test in CI (elastic#75266) [Task Manager] time out work when it overruns in poller (elastic#74980) [Drilldowns] misc improvements & fixes (elastic#75276) Small README note on bumping memory for builds (elastic#75247) [Security Solution][Detections] Adds exception modal tests (elastic#74596) Revert "Revert "added missing core docs"" Revert "Revert "added version to saved object bulk creation"" [Dashboard] Sample data link does not work (elastic#75262) [Dashboard First] Unlink from Library Action With ReferenceOrValueEmbeddable (elastic#74905) [Form lib] Fix issue where serializer on fields are called on every change (elastic#75166) convert processor labels to sentence case (elastic#75278) [Monaco] Refactor the way XJSON grammar checker gets registered (elastic#75160) Clarify no documents error message when filtering by is_training (elastic#75227) [Lens] Fix crash when two layers xychart switches to pie (elastic#75267) [Observability Homepage] Fix console error because of side effect (elastic#75258) [Usage Collection] Add `legacy=true` option to the /api/stats request in the docs (elastic#75146) [ML] Functional tests - re-activate DFA test suites (elastic#75257) GS providers improvements (elastic#75174) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue on the form lib where a
serializerdeclared on aFieldConfigwas called on every value change. This was not intended, as serializers could potentially be expensive (e.g.JSON.parse) and should only be called when building the form data. (callingform.submit()orform.getFormData()).This could have an impact on our current forms using the
<FormDataProvider />as now with this PR, the value returned is not going through the serializer anymore and might defer from what the consumer expects. I have checked in the 3 plugins (index_management, ingest_pipline, security_solution) and I only found 1 potential risk of regression: in the "security_solution" plugin.https://github.com/elastic/kibana/blob/master/x-pack/plugins/security_solution/public/detections/components/rules/step_about_rule/schema.tsx#L126
@elastic/siem-security-team Can you let me know if it is expected to convert the string to a number on every field value change? I will then have to update the code to use a
formatter. (like we do here: https://github.com/elastic/kibana/blob/master/x-pack/plugins/index_management/public/application/components/component_templates/component_template_wizard/component_template_form/steps/step_logistics_schema.tsx#L64)Fixes #74948