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

fix(explore): only refresh data panel on relevant changes #16699

Merged
merged 2 commits into from
Sep 14, 2021

Conversation

villebro
Copy link
Member

@villebro villebro commented Sep 14, 2021

SUMMARY

Every time control state is updated on the Explore view, the data panel requests new data, even when the changes are known not to affect the chart data (renderTrigger property set to true). This PR changes ExploreChartPanel to only refresh the queryFormData that's used by DataTablesPane if the triggerRender prop is not true (is falsy when a query has been issued). This only happens when the chart needs to be rerendered without rerequesting data.

AFTER

before2.mp4

BEFORE

before.mp4

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

if (!props.triggerRender) {
setQueryFormData(props.chart.latestQueryFormData);
}
}, [props.chart.latestQueryFormData]);
Copy link
Member

Choose a reason for hiding this comment

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

Should we include triggerRender in deps array?

Copy link
Member Author

Choose a reason for hiding this comment

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

No - that would cause it to trigger when we change controls whose renderTrigger prop is set to true.

Copy link
Member

Choose a reason for hiding this comment

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

that would run useEffect function, but we'd exit at if check, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right you are - adding it!

Copy link
Member Author

@villebro villebro Sep 14, 2021

Choose a reason for hiding this comment

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

Actually, this causes a rerender when making changes to controls that don't have renderTrigger set to true (a rerendering should only trigger after running the query):
https://user-images.githubusercontent.com/33317356/133249851-49e9ceb3-0865-4172-b915-0c2c2b0c5bdc.mp4

Copy link
Member

@kgabryje kgabryje Sep 14, 2021

Choose a reason for hiding this comment

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

Got it, thanks for explanation! In that case, can we add eslint suppress warning? I think it's time we started getting rid of those errors wherever possible 🙂 (though actually that's up for debate if we should suppress those warnings...)

Copy link
Member Author

@villebro villebro Sep 14, 2021

Choose a reason for hiding this comment

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

I added a comment + suppressed the warning 👍

@codecov
Copy link

codecov bot commented Sep 14, 2021

Codecov Report

Merging #16699 (7a411fa) into master (5ac8ac0) will decrease coverage by 0.00%.
The diff coverage is 20.00%.

❗ Current head 7a411fa differs from pull request most recent head ad73d31. Consider uploading reports for the commit ad73d31 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16699      +/-   ##
==========================================
- Coverage   76.93%   76.93%   -0.01%     
==========================================
  Files        1007     1007              
  Lines       54112    54117       +5     
  Branches     7346     7348       +2     
==========================================
+ Hits        41633    41634       +1     
- Misses      12239    12243       +4     
  Partials      240      240              
Flag Coverage Δ
javascript 71.24% <20.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ntend/src/explore/components/ExploreChartPanel.jsx 14.28% <0.00%> (-0.72%) ⬇️
...nd/src/explore/components/DataTablesPane/index.tsx 75.49% <100.00%> (+0.24%) ⬆️

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 5ac8ac0...ad73d31. Read the comment docs.

@villebro villebro merged commit c99cacb into apache:master Sep 14, 2021
@villebro villebro deleted the villebro/data-panel-refresh branch September 14, 2021 12:58
@villebro villebro added the v1.3 label Sep 22, 2021
villebro added a commit that referenced this pull request Sep 22, 2021
* fix(explore): only refresh data panel on relevant changes

* add comment and supress warning

(cherry picked from commit c99cacb)
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
* fix(explore): only refresh data panel on relevant changes

* add comment and supress warning
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
* fix(explore): only refresh data panel on relevant changes

* add comment and supress warning
@mistercrunch mistercrunch added 🍒 1.3.1 🍒 1.3.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 labels Mar 13, 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 preset-io size/S v1.3 🍒 1.3.1 🍒 1.3.2 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants