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): Chart stuck in loading state when when datasets request and chart request fail #19327

Merged
merged 1 commit into from
Mar 23, 2022

Conversation

kgabryje
Copy link
Member

SUMMARY

When chart's request fails, we wait with displaying an error message until datasources are loaded. However, when datasources request also fails, the chart is stuck in loading state instead of displaying an error. This PR fixes that issue by passing the status of datasets request to the chart renderer, so that when datasources request fails, we display chart's error message.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
image

After:
Screenshot 2022-03-23 at 12 49 29

TESTING INSTRUCTIONS

  1. Create a dashboard
  2. Add a chart which request fails for whatever reason
  3. Make sure that the /dashboard/${id}/datasets request fails (maybe with some intercepting tool like Requestly?)

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

Copy link
Member

@villebro villebro 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 getting to the bottom of this edge case!

Comment on lines -219 to +223
datasource === PLACEHOLDER_DATASOURCE
datasource === PLACEHOLDER_DATASOURCE &&
datasetsStatus !== ResourceStatus.ERROR
Copy link
Member

Choose a reason for hiding this comment

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

I haven't worked on this component for a while, but I would have expected it to check the other way around, i.e. are the conditions met for displaying the error, and if not, only then display the spinner. But I don't propose changing this now as it would probably introduce unnecessary regression risk.

@codecov
Copy link

codecov bot commented Mar 23, 2022

Codecov Report

Merging #19327 (469b583) into master (a8a48af) will decrease coverage by 0.00%.
The diff coverage is 28.57%.

@@            Coverage Diff             @@
##           master   #19327      +/-   ##
==========================================
- Coverage   66.62%   66.61%   -0.01%     
==========================================
  Files        1671     1672       +1     
  Lines       64556    64545      -11     
  Branches     6506     6500       -6     
==========================================
- Hits        43009    42997      -12     
  Misses      19864    19864              
- Partials     1683     1684       +1     
Flag Coverage Δ
javascript 51.31% <28.57%> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
superset-frontend/src/components/Chart/Chart.jsx 52.45% <ø> (-1.64%) ⬇️
superset-frontend/src/dashboard/actions/hydrate.js 2.12% <ø> (ø)
.../src/dashboard/components/gridComponents/Chart.jsx 60.20% <ø> (ø)
...rontend/src/dashboard/containers/DashboardPage.tsx 5.26% <0.00%> (-0.12%) ⬇️
...-frontend/src/dashboard/reducers/dashboardState.js 72.34% <0.00%> (-1.58%) ⬇️
...t-frontend/src/dashboard/actions/dashboardState.js 36.54% <50.00%> (+0.13%) ⬆️
...perset-frontend/src/dashboard/containers/Chart.jsx 75.00% <100.00%> (ø)
superset-frontend/src/utils/urlUtils.ts 36.73% <0.00%> (ø)
superset-frontend/src/views/components/Menu.tsx 60.00% <0.00%> (ø)
... and 17 more

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 a8a48af...469b583. Read the comment docs.

@kgabryje kgabryje merged commit a08f83b into apache:master Mar 23, 2022
michael-hoffman-26 pushed a commit to nielsen-oss/superset that referenced this pull request Mar 23, 2022
villebro pushed a commit that referenced this pull request Apr 3, 2022
…st and chart request fail (#19327)

(cherry picked from commit a08f83b)
philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
@mistercrunch mistercrunch added 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.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 lts-v1 size/M 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants