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(dashboard): incorrect chart error with slow dataset api request #18852

Merged
merged 3 commits into from
Feb 23, 2022

Conversation

ktmud
Copy link
Member

@ktmud ktmud commented Feb 22, 2022

SUMMARY

Fix a bug where sever side chart data query errors were displayed as "No results" when the /dashboard/[id]/datasets API is slow.

Background

#15699 made loading full datasource info for Dashboard charts async, however, some chart types didn't handle incomplete datasource info properly, causing JS errors. #15993 fixed that by re-rendering the charts after the datasources are fully loaded. Then a “No results" state for dashboard chart container is introduced in

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

Charts with server side errors may show as "no results":

Xnip2022-02-22_11-17-46

After

Server side errors correctly rendered as unexpected errors:

Xnip2022-02-22_11-16-44

TESTING INSTRUCTIONS

Here's how to reproduce the bug:

  1. Go to a dashboard where the dashboard/datasets API may be slow---e.g. dashboard that used a large dataset with a lot of columns
  2. Make sure users have access control error (or any other server side errors) when accessing one of the charts
  3. Refresh the page until you see the datasets API returns later than the chart data api:
    Xnip2022-02-22_12-05-00

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

@ktmud ktmud requested a review from etr2460 February 22, 2022 20:22
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.

lgtm, thanks for the quick fix

@@ -220,6 +220,7 @@ class Chart extends React.PureComponent {

return (
<ChartErrorMessage
key={chartId}
Copy link
Member

Choose a reason for hiding this comment

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

was this needed to fix the issue too? i'm surprised that setting the key to the id would cause a rerender since i wouldn't expect the id to ever change

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a bycatch. Just for fixing a React warning about missing key in loops.

Copy link
Member

Choose a reason for hiding this comment

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

ah thanks, i didn't see a loop anywhere. does this mean the Styles above needs a key too?

Copy link
Member Author

Choose a reason for hiding this comment

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

@codecov
Copy link

codecov bot commented Feb 22, 2022

Codecov Report

Merging #18852 (76f2ebc) into master (0ae1ca7) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #18852   +/-   ##
=======================================
  Coverage   66.21%   66.21%           
=======================================
  Files        1633     1633           
  Lines       63210    63210           
  Branches     6409     6409           
=======================================
  Hits        41852    41852           
  Misses      19698    19698           
  Partials     1660     1660           
Flag Coverage Δ
javascript 51.02% <0.00%> (ø)

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

Impacted Files Coverage Δ
superset-frontend/src/chart/Chart.jsx 51.78% <ø> (ø)
superset-frontend/src/chart/chartReducer.ts 25.00% <0.00%> (ø)

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 0ae1ca7...76f2ebc. Read the comment docs.

@ktmud ktmud force-pushed the dashboard-chart-access-error branch from 157843b to 76f2ebc Compare February 23, 2022 17:19
@ktmud ktmud merged commit cdd4fa5 into apache:master Feb 23, 2022
@john-bodley john-bodley deleted the dashboard-chart-access-error branch June 8, 2022 05:32
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.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 size/XS 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants