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) Adds optional chaining to avoid runtime error #22213

Conversation

eric-briscoe
Copy link
Contributor

SUMMARY

Adds optional chaining to avoid runtime error when performing dot operator on null or undefined value. In the case a bad componentId was provided to these utility functions the code would throw a runtime error in loop causing the removal of a component or dashboard tab to fail.

If there is a dashboard filter (even if not applied) deleting a tab will hit the line that causes error with a bad componentId. If there is a dashboard filter AND it is applied, then removing a component will hit the line that causes error with a bad componentId.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

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

@codecov
Copy link

codecov bot commented Nov 23, 2022

Codecov Report

Merging #22213 (68d1484) into master (3bc0865) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           master   #22213   +/-   ##
=======================================
  Coverage   66.92%   66.92%           
=======================================
  Files        1835     1835           
  Lines       69988    69988           
  Branches     7612     7612           
=======================================
  Hits        46839    46839           
  Misses      21183    21183           
  Partials     1966     1966           
Flag Coverage Δ
javascript 53.75% <0.00%> (ø)

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

Impacted Files Coverage Δ
...nd/src/dashboard/components/nativeFilters/utils.ts 46.66% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

LGTM

@kgabryje kgabryje merged commit 1831e8c into apache:master Nov 24, 2022
sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Nov 28, 2022
@sadpandajoe
Copy link
Contributor

🏷️ preset:2022.47

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 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/S 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants