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

[Explore view] Fix extra data fetch when user clicks Run Query #8070

Merged

Conversation

graceguo-supercat
Copy link

@graceguo-supercat graceguo-supercat commented Aug 19, 2019

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

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 a componentDidupdate 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

Il9FmAes6u

After
disyNsnsY6

TEST PLAN

CI and manual test

REVIEWERS

@etr2460 @michellethomas

@codecov-io
Copy link

codecov-io commented Aug 19, 2019

Codecov Report

Merging #8070 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
...ts/src/explore/components/ExploreViewContainer.jsx 47.05% <ø> (+1.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e7ea3f...4397512. Read the comment docs.

Copy link
Member

@etr2460 etr2460 left a 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();
Copy link
Member

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?

Copy link
Author

Choose a reason for hiding this comment

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

@graceguo-supercat graceguo-supercat merged commit 319c1df into apache:master Aug 20, 2019
graceguo-supercat pushed a commit to graceguo-supercat/superset that referenced this pull request Aug 20, 2019
@graceguo-supercat graceguo-supercat deleted the gg-FixExtraFetchExploreView branch September 21, 2019 08:09
@villebro villebro added the v0.34 label Sep 27, 2019
@mistercrunch mistercrunch added 🍒 0.34.1 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.35.0 labels Feb 28, 2024
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/S v0.34 🍒 0.34.1 🚢 0.35.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants