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(sqllab): dedupe active_tab in tabHistory #23265

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

justinpark
Copy link
Member

SUMMARY

When SQLLAB_BACKEND_PERSISTENCE has been deactivated after activated, active_tab will be provided during localstorage persistence mode.
This causes the appending duplicated tabId value every time page is loaded.
This commit adds the dedupe logic to clean up the duplicated values.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

  • After

Screenshot 2023-03-02 at 10 24 21 AM

  • Before

Screenshot 2023-03-02 at 10 23 38 AM

TESTING INSTRUCTIONS

set SQLLAB_BACKEND_PERSISTENCE on and open SqlLab
disable SQLLAB_BACKEND_PERSISTENCE and open SqlLab
keep refresh the page and then check the redux value in the local storage

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 Mar 2, 2023

Codecov Report

Merging #23265 (e27b937) into master (d16eda6) will increase coverage by 1.76%.
The diff coverage is 38.09%.

❗ Current head e27b937 differs from pull request most recent head ffa3e13. Consider uploading reports for the commit ffa3e13 to get more accurate results

@@            Coverage Diff             @@
##           master   #23265      +/-   ##
==========================================
+ Coverage   65.74%   67.51%   +1.76%     
==========================================
  Files        1907     1907              
  Lines       73431    73438       +7     
  Branches     7973     7977       +4     
==========================================
+ Hits        48280    49583    +1303     
+ Misses      23103    21803    -1300     
- Partials     2048     2052       +4     
Flag Coverage Δ
javascript 53.77% <46.15%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
superset-frontend/src/dashboard/actions/hydrate.js 2.08% <ø> (+0.02%) ⬆️
...src/dashboard/components/DashboardBuilder/state.ts 70.37% <ø> (-2.05%) ⬇️
...tiveFilters/FilterBar/CrossFilters/CrossFilter.tsx 56.25% <0.00%> (ø)
...rontend/src/dashboard/containers/DashboardPage.tsx 8.79% <0.00%> (-0.10%) ⬇️
...uperset-frontend/src/pages/ChartCreation/index.tsx 58.62% <0.00%> (-3.20%) ⬇️
superset/dashboards/schemas.py 99.48% <ø> (-0.01%) ⬇️
superset/utils/webdriver.py 81.03% <25.00%> (ø)
...et-frontend/src/dashboard/actions/sliceEntities.js 77.14% <50.00%> (-1.65%) ⬇️
...rset-frontend/src/explore/components/SaveModal.tsx 37.96% <66.66%> (-0.72%) ⬇️
...et-frontend/src/SqlLab/reducers/getInitialState.js 50.00% <100.00%> (+3.33%) ⬆️
... and 91 more

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

@@ -19,6 +19,14 @@
import { t } from '@superset-ui/core';
import getToastsFromPyFlashMessages from 'src/components/MessageToasts/getToastsFromPyFlashMessages';

export function dedupeTabHistory(tabHistory) {
Copy link
Member

Choose a reason for hiding this comment

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

I think you can maybe just skip appending if the last id is the same as current id? Removing duplicates are not necessary when things are working as expected. If a users's localStorage already has bad states because of this, we can just ask them to clear the local storage or close the tabs manually themelves.

@rusackas rusackas merged commit b1526c1 into apache:master Mar 22, 2023
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.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 size/S 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants