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: Filter throwing an error on Embedded Dashboard #21157

Merged

Conversation

lilykuang
Copy link
Member

SUMMARY

image
when browser is set to block third-party cookies, the filter gets SecurityError: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document. This pr is to fix this issue

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 Aug 23, 2022

Codecov Report

Merging #21157 (ccaf011) into master (f77b910) will increase coverage by 0.02%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master   #21157      +/-   ##
==========================================
+ Coverage   66.36%   66.38%   +0.02%     
==========================================
  Files        1781     1781              
  Lines       67871    67878       +7     
  Branches     7239     7242       +3     
==========================================
+ Hits        45040    45064      +24     
+ Misses      20973    20956      -17     
  Partials     1858     1858              
Flag Coverage Δ
javascript 52.29% <0.00%> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
superset-frontend/src/hooks/useTabId.ts 0.00% <0.00%> (ø)
superset/databases/api.py 95.49% <0.00%> (+0.32%) ⬆️
superset/reports/commands/execute.py 91.54% <0.00%> (+0.35%) ⬆️
superset/views/base_api.py 98.38% <0.00%> (+0.40%) ⬆️
superset/common/query_object.py 94.38% <0.00%> (+0.51%) ⬆️
superset/commands/importers/v1/utils.py 93.50% <0.00%> (+1.29%) ⬆️
superset/databases/commands/validate_sql.py 94.00% <0.00%> (+2.00%) ⬆️
superset/reports/commands/log_prune.py 89.28% <0.00%> (+3.57%) ⬆️
superset/db_engine_specs/postgres.py 96.61% <0.00%> (+5.93%) ⬆️
superset/sql_validators/__init__.py 100.00% <0.00%> (+20.00%) ⬆️
... and 1 more

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

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

Thanks for investigating this @lilykuang.

Your current solution will generate the same id for different tabs. Unique tab ids are important to allow users to work on multiple tabs while isolating each tab's context. When working on this feature, the original solution stored the tab_id in the URL to reuse it when available. We optimized it to use localStorage to avoid the extra parameter but if there's no storage available we could do just that.

We could also create a utility function in src/utils/localStorageHelpers.ts to check for storage availability.

function isStorageAvailable() {
  try {
    return window.localStorage && window.sessionStorage;
  } catch (error) {
    return false;
  }
}

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

LGTM

@lilykuang lilykuang merged commit 604e30b into apache:master Aug 24, 2022
@lilykuang lilykuang deleted the lily/fix-filter-error-embedded-dashboard branch August 24, 2022 16:38
@AAfghahi AAfghahi added the v2.0 label Jan 24, 2023
lilykuang added a commit to preset-io/superset that referenced this pull request Feb 23, 2023
* fix: Filter throwing an error on Embedded Dashboard

* use short_id if storage not available

* avoid infinite loop

(cherry picked from commit 604e30b)
lilykuang added a commit that referenced this pull request Feb 25, 2023
* fix: Filter throwing an error on Embedded Dashboard

* use short_id if storage not available

* avoid infinite loop

(cherry picked from commit 604e30b)
@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

6 participants