-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Conversation
💚 Build Succeeded |
Could we please add an test, that changing the |
💔 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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be removed
There was a problem hiding this 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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be removed
💚 Build Succeeded |
There was a problem hiding this 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?
@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. |
@ppisljar Great, I've updated the PR description with this. |
jenkins, test this |
💚 Build Succeeded |
This reverts commit 23edabc.
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 tofetchAndRender
is theforceFetch
.