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

[Maps] keep local metrics editor state and only submit metrics to redux store when valid #84828

Merged
merged 6 commits into from
Dec 9, 2020

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Dec 2, 2020

Help remove edge cases that #83586 has to handle by only pushing valid metrics to redux instead of pushing all metric state changes to redux.

For example, prior to this PR, redux would get updated twice, the first time with invalid state.
Change aggregation type from 'count' to 'avg'
push redux with invalid metric { type: 'avg' }
Select field
push redux with metric { type: 'avg', field: 'my field' }

With this PR, now there is only a single redux state change
Change aggregation type from 'count' to 'avg'
update local state with metric { type: 'avg' }
Select field
update local state with metric { type: 'avg', field: 'my field' }
push local state to redux state

@nreese nreese added chore [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.11.0 labels Dec 2, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

@nreese nreese changed the title [Maps] keep invalid metrics editor state local and only submit metrics state when valid [Maps] keep local metrics editor state local and only submit metrics to redux store when valid Dec 2, 2020
@nreese nreese changed the title [Maps] keep local metrics editor state local and only submit metrics to redux store when valid [Maps] keep local metrics editor state and only submit metrics to redux store when valid Dec 2, 2020
@nreese
Copy link
Contributor Author

nreese commented Dec 2, 2020

@elasticmachine merge upstream

@nreese
Copy link
Contributor Author

nreese commented Dec 7, 2020

@elasticmachine merge upstream

@nreese
Copy link
Contributor Author

nreese commented Dec 8, 2020

@elasticmachine merge upstream

Copy link
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for the refactor. this is a really nice pattern, and should remember it going forward for all our forms, not to try and clutter redux-store with invalid state.

@nreese
Copy link
Contributor Author

nreese commented Dec 9, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
maps 2.8MB 2.8MB +975.0B

Distributable file count

id before after diff
default 46982 47742 +760

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@nreese nreese merged commit b045a95 into elastic:master Dec 9, 2020
nreese added a commit to nreese/kibana that referenced this pull request Dec 9, 2020
…ux store when valid (elastic#84828)

* [Maps] keep invalid metrics editor state local and only submit metrics state when valid

* review feedback

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
nreese added a commit that referenced this pull request Dec 9, 2020
…ux store when valid (#84828) (#85437)

* [Maps] keep invalid metrics editor state local and only submit metrics state when valid

* review feedback

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation release_note:skip Skip the PR/issue when compiling release notes v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants