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

[Lens] Clean up range operation state handling #83420

Closed
flash1293 opened this issue Nov 16, 2020 · 1 comment · Fixed by #89305
Closed

[Lens] Clean up range operation state handling #83420

flash1293 opened this issue Nov 16, 2020 · 1 comment · Fixed by #89305
Assignees
Labels
Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure technical debt Improvement of the software architecture and operational architecture

Comments

@flash1293
Copy link
Contributor

The range operation ("Intervals" in UI) is currently reading a value from ui settings on first render of the UI, writing it into the persistent datasource state. This is happening to determine the default value for the granularity slider and to use the value for the first range when switching to manual intervals.

This has several problems:

  • The behavior is only triggered if the UI is actually rendered, which is not always the case (e.g. if the user just drops a field without opening the flyout)
  • Changing the ui setting won't be reflected in saved visualizations because they keep the old state around by themselfes

To clean this up, the following approach should be taken:
Do not update the state on first render, but keep the ui setting only in the local state of the UI and use it as a fallback if the datasource state value is still null. As soon as the user starts messing with the settings, use the value the user configured and save it in datasource state.

@flash1293 flash1293 added technical debt Improvement of the software architecture and operational architecture Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens labels Nov 16, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure technical debt Improvement of the software architecture and operational architecture
Projects
None yet
3 participants