-
Notifications
You must be signed in to change notification settings - Fork 14k
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
[Explore view] Fix extra data fetch when user clicks Run Query #8070
[Explore view] Fix extra data fetch when user clicks Run Query #8070
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8070 +/- ##
==========================================
+ Coverage 65.57% 65.58% +0.01%
==========================================
Files 469 469
Lines 22496 22492 -4
Branches 2446 2445 -1
==========================================
Hits 14752 14752
+ Misses 7624 7620 -4
Partials 120 120
Continue to review full report at Codecov.
|
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.
assuming i understand this, lgtm
@@ -131,8 +131,6 @@ class ExploreViewContainer extends React.Component { | |||
|
|||
/* eslint no-unused-vars: 0 */ | |||
componentDidUpdate(prevProps, prevState) { | |||
this.triggerQueryIfNeeded(); |
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.
This can be removed because the child component is handling the refresh, correct?
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.
CATEGORY
Choose one
SUMMARY
In explore view, when user change controls and run query again, data fetch are triggered twice. see the animated gif below.
I believe this issue was introduced since #7233. Before that, dashboard will trigger new queries for all charts in dashboard when filter is updated, even for those charts are under nested tabs and not visible.
In #7233, we only updated query parameters when filter is updated, but delayed the trigger for new query until chart becomes visible. Instead of call
postChartFormData
to trigger data fetching API, I added acomponentDidupdate
method for chart component, and use react component state change and triggerQuery flag to trigger the data fetch.Currently explore view container component it also has componentDidUpdate, it will call data fetching API on parent component updated. Together with chart's componentDidupdate change, that's the reason data fetching is called twice.
Solution:
Do not need to call
postChartFormData
from exploreview container component.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before
After
TEST PLAN
CI and manual test
REVIEWERS
@etr2460 @michellethomas