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

fixing onUiState event handler #21715

Merged
merged 5 commits into from
Aug 10, 2018
Merged

Conversation

ppisljar
Copy link
Member

@ppisljar ppisljar commented Aug 7, 2018

resolves partly #21480: avoid refetch when using absolute time ranges. With relative times the timerange will actually change everytime and a new request will be made.

the uiState change event will pass the name of the property that changed as the first parameter to the listener function. We don't want that in this scenario, as the first parameter to fetchAndRender is the forceFetch.

@ppisljar ppisljar added review Feature:Visualizations Generic visualization features (in case no more specific feature label is available) v7.0.0 v6.4.0 v6.5.0 labels Aug 7, 2018
@ppisljar ppisljar requested review from timroes and markov00 August 7, 2018 07:03
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@timroes
Copy link
Contributor

timroes commented Aug 7, 2018

Could we please add an test, that changing the uiState won't trigger a force refetch on the VisualizeDataLoader.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@@ -322,6 +332,32 @@ describe('visualize loader', () => {

sinon.assert.calledOnce(spy);
sinon.assert.calledWith(spy, sinon.match({ timeRange: { from: 'now-10d/d', to: 'now' } }));

//VisualizeDataLoader.prototype.fetch.restore()
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs to be removed

Copy link
Contributor

@timroes timroes left a comment

Choose a reason for hiding this comment

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

Looks good to me, once test passes and commented code is removed.

sinon.assert.calledOnce(spy);
sinon.assert.calledWith(spy, sinon.match({ forceFetch: false }));

//VisualizeDataLoader.prototype.fetch.restore()
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs to be removed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

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

Code LGTM but after pulling the PR and testing on few charts seems that the behaviour still exists, in particular:

  • if you open and close the legend with an absolute time range no data is refetched (correct behaviour)
  • if you open and close legend using a relative time range, new data for the touched chart is fetched.

If this is the designed way, feel free to ignore this review and go on. If not we have to find a way to disable forceFetching also on relative time ranges.

Could you also please specify what "resolves partly" means. What are the partial part missing on this PR?

@ppisljar
Copy link
Member Author

@markov00, thats why this only partly resolves the original issue. With relative times the timerange will actually change everytime and a new request will be made.

@markov00
Copy link
Member

@ppisljar Great, I've updated the PR description with this.

@ppisljar
Copy link
Member Author

jenkins, test this

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@ppisljar ppisljar merged commit 23edabc into elastic:master Aug 10, 2018
ppisljar added a commit to ppisljar/kibana that referenced this pull request Aug 10, 2018
@ppisljar ppisljar deleted the fix/legendRefetch branch August 10, 2018 09:37
ppisljar added a commit to ppisljar/kibana that referenced this pull request Aug 10, 2018
epixa added a commit to epixa/kibana that referenced this pull request Aug 10, 2018
@ppisljar ppisljar restored the fix/legendRefetch branch September 26, 2018 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Visualizations Generic visualization features (in case no more specific feature label is available) review v6.4.0 v6.5.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants