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

feat: Use SPA navigation between AddSlice and Dataset list pages #21683

Merged
merged 1 commit into from
Oct 4, 2022

Conversation

kgabryje
Copy link
Member

@kgabryje kgabryje commented Oct 3, 2022

SUMMARY

  1. "Add a dataset" link in AddSlice page - instead of opening in a new tab, use SPA navigation to open dataset creation modal in the same tab.
  2. "Add dataset and create chart" button in dataset creation modal - use SPA navigation to open AddSlice page with new dataset preselected

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen.Recording.2022-10-03.at.16.01.01.mov

TESTING INSTRUCTIONS

  1. Open AddSlice page and click "Add a dataset"
  2. Verify that datasets page with dataset creation modal opens in the same tab
  3. Verify that clicking back button navigates back to AddSlice page
  4. Verify that creating a dataset opens AddSlice page with the new dataset preselected
  5. Cmd + click "Add a dataset" to open dataset creation page in a new tab and repeat steps 2-4.

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

};

const hide = () => {
cleanup();
Copy link
Member Author

Choose a reason for hiding this comment

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

I separated the cleanup functions from onHide(), because onHide does history.replace, which causes race condition with history.push in line 131

@codecov
Copy link

codecov bot commented Oct 3, 2022

Codecov Report

Merging #21683 (5d10e58) into master (389fa31) will decrease coverage by 0.00%.
The diff coverage is 42.85%.

@@            Coverage Diff             @@
##           master   #21683      +/-   ##
==========================================
- Coverage   66.82%   66.82%   -0.01%     
==========================================
  Files        1798     1799       +1     
  Lines       68824    68824              
  Branches     7331     7332       +1     
==========================================
- Hits        45994    45992       -2     
  Misses      20952    20952              
- Partials     1878     1880       +2     
Flag Coverage Δ
javascript 53.15% <42.85%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
...perset-frontend/src/addSlice/AddSliceContainer.tsx 59.61% <ø> (ø)
...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx 44.18% <42.85%> (+1.68%) ⬆️
...et-ui-chart-controls/src/shared-controls/index.tsx 54.23% <0.00%> (-2.91%) ⬇️
...d/src/SqlLab/components/SqlEditorLeftBar/index.tsx 52.23% <0.00%> (-2.05%) ⬇️
...d/src/SqlLab/components/ShareSqlLabQuery/index.tsx 80.76% <0.00%> (-1.99%) ⬇️
...c/SqlLab/components/RunQueryActionButton/index.tsx 72.72% <0.00%> (-0.81%) ⬇️
...d/src/SqlLab/components/AceEditorWrapper/index.tsx 58.22% <0.00%> (-0.75%) ⬇️
...frontend/src/SqlLab/components/SqlEditor/index.jsx 53.84% <0.00%> (-0.51%) ⬇️
...frontend/src/SqlLab/components/SaveQuery/index.tsx 76.74% <0.00%> (ø)
...d/src/SqlLab/components/QueryLimitSelect/index.tsx 100.00% <0.00%> (ø)
... and 3 more

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

window.location.href = `/chart/add?dataset=${currentTableName}`;
hide();
history.push(`/chart/add?dataset=${currentTableName}`);
cleanup();
Copy link
Member

Choose a reason for hiding this comment

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

The previous version had a call to onHide. Should we keep it?

const hide = () => {
    setItem(LocalStorageKeys.db, null);
    clearModal();
    onHide();
};

Copy link
Member Author

Choose a reason for hiding this comment

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

No, onHide only executed history.replace, which was supposed to remove the #create from URL. We only want it when we close the modal, otherwise it causes a race condition with history.push from line 131 (explained in https://github.com/apache/superset/pull/21683/files#r985828109)

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

@kgabryje kgabryje merged commit 2907869 into apache:master Oct 4, 2022
@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

3 participants