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

[cache] Render label when cached #7164

Merged

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Mar 29, 2019

A result set may return zero rows which is then cached (as expected) however this isn't evident in the explorer UI and thus there's no way to force refresh the query.

Note this also fixes an issue where the success state was ignored given we were checking an indexOf being strictly greater than zero.

Before
Screen Shot 2019-03-28 at 5 30 58 PM

After
Screen Shot 2019-03-28 at 5 31 47 PM

to: @kristw @michellethomas @mistercrunch

@john-bodley john-bodley added the !deprecated-label:bug Deprecated label - Use #bug instead label Mar 29, 2019
@codecov-io
Copy link

Codecov Report

Merging #7164 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7164      +/-   ##
==========================================
+ Coverage   64.63%   64.64%   +<.01%     
==========================================
  Files         422      422              
  Lines       20607    20606       -1     
  Branches     2253     2253              
==========================================
  Hits        13320    13320              
+ Misses       7165     7164       -1     
  Partials      122      122
Impacted Files Coverage Δ
...sets/src/explore/components/ExploreChartHeader.jsx 51.42% <100%> (+1.42%) ⬆️

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 36a6fad...46f3445. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Mar 29, 2019

Codecov Report

Merging #7164 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7164   +/-   ##
=======================================
  Coverage   64.62%   64.62%           
=======================================
  Files         422      422           
  Lines       20593    20593           
  Branches     2253     2253           
=======================================
  Hits        13309    13309           
  Misses       7161     7161           
  Partials      123      123
Impacted Files Coverage Δ
...sets/src/explore/components/ExploreChartHeader.jsx 50% <100%> (ø) ⬆️

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 5192270...79e467d. Read the comment docs.

@@ -94,7 +94,6 @@ class ExploreChartHeader extends React.PureComponent {
chartUpdateStartTime,
latestQueryFormData,
queryResponse } = this.props.chart;
const chartSucceeded = ['success', 'rendered'].indexOf(this.props.chart.chartStatus) > 0;

Choose a reason for hiding this comment

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

please ignore previous review. i read it wrong...

<RowCountLabel
rowcount={queryResponse.rowcount}
limit={formData.row_limit}
/>}
{chartSucceeded && queryResponse && queryResponse.is_cached &&
{queryResponse && queryResponse.is_cached &&
Copy link

@graceguo-supercat graceguo-supercat Mar 29, 2019

Choose a reason for hiding this comment

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

The logic here says we should only render cache label when

  • fetch data succeeded, and
  • has query response, and
  • queryResponse.is_cached is true.

in No data case, we should not render cache label, and should not allow or ask user to force refresh.

@graceguo-supercat
Copy link

Here is an example response for No Data. is_cached is always false for No Data response:

Screen Shot 2019-03-28 at 11 22 45 PM

@john-bodley
Copy link
Member Author

@graceguo-supercat is_cached is not always false when the error is No data. Note this is set here and could be the result of a successful query where the result set has no rows though is_cached would be true (per here).

@graceguo-supercat
Copy link

@john-bodley Thanks for your correction, is_cached flag is based on query not results.
I think chartSucceeded flag is to make sure when chart is loading (show spinner), we should not show cache label and should not allow user to force refresh.

@john-bodley john-bodley force-pushed the john-bodley--fix-cache-no-data branch 2 times, most recently from 0d53dc0 to e72d658 Compare April 2, 2019 17:53
@john-bodley
Copy link
Member Author

@graceguo-supercat I addressed your comments.

@john-bodley john-bodley force-pushed the john-bodley--fix-cache-no-data branch from e72d658 to 79e467d Compare April 9, 2019 19:49
@john-bodley john-bodley merged commit 9216639 into apache:master Apr 9, 2019
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 28, 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 !deprecated-label:bug Deprecated label - Use #bug instead 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants