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: undefined error when anonymous user browses dashboards or charts #17117

Merged
merged 1 commit into from
Oct 15, 2021

Conversation

wijnanjo
Copy link
Contributor

SUMMARY

Prevent 'undefined' error when viewing the dashboard (or charts) listview in an anonymous mode.

TESTING INSTRUCTIONS

Reproduce the error as follows:

  • Allow anonymous access by setting PUBLIC_ROLE_LIKE = "Gamma"
  • Without logging in, click on dashboards or charts. This error displays:
    Unexpected error: TypeError: Cannot read properties of undefined (reading 'toString')

Cause: there's no null check on the userId variable.

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

@pkdotson
Copy link
Member

@wijnanjo can you please add before/after video of the fix.

@codecov
Copy link

codecov bot commented Oct 14, 2021

Codecov Report

Merging #17117 (2a2fbdd) into master (d944503) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #17117   +/-   ##
=======================================
  Coverage   76.86%   76.86%           
=======================================
  Files        1031     1031           
  Lines       55198    55198           
  Branches     7504     7506    +2     
=======================================
+ Hits        42428    42429    +1     
+ Misses      12520    12519    -1     
  Partials      250      250           
Flag Coverage Δ
javascript 70.92% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...perset-frontend/src/views/CRUD/chart/ChartList.tsx 74.35% <100.00%> (ø)
...rontend/src/views/CRUD/dashboard/DashboardList.tsx 72.22% <100.00%> (ø)
...eFilters/FiltersConfigModal/FiltersConfigModal.tsx 90.16% <0.00%> (+0.81%) ⬆️

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 d944503...2a2fbdd. Read the comment docs.

@wijnanjo
Copy link
Contributor Author

@pkdotson Here's a video showing before/after fix behavior:
fix_undefined_user

Copy link
Member

@pkdotson pkdotson 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 fix!

@pkdotson pkdotson merged commit c9c669d into apache:master Oct 15, 2021
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
@eschutho eschutho added the v1.4 label Nov 23, 2021
eschutho pushed a commit that referenced this pull request Nov 23, 2021
Co-authored-by: jo.wijnant <[email protected]>
(cherry picked from commit c9c669d)
@mistercrunch mistercrunch added 🍒 1.4.0 🍒 1.4.1 🍒 1.4.2 🏷️ 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 v1.4 🍒 1.4.0 🍒 1.4.1 🍒 1.4.2 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants