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

refactor(sqllab): nonblocking delete query editor #29233

Merged

Conversation

justinpark
Copy link
Member

SUMMARY

Following up #24539
This commit modifies the removeQueryEditor function to asynchronously handle the process of deleting a queryEditor in localStorage in the same way as in non-persistent mode and periodically post deleted items to persistence via AutoSync's deleteSqlEditor.

This commit made the following changes:

  • In persistence mode, deleting a tab will no longer block the removal until it is fetched. Instead, the tab will be immediately discarded and stored the deleted ids in the local storage. (destroyedQueryEditors)
  • removeQueryEditor has been modified to always update to localStorage in the same way as in non-persistence mode
  • EditorAutoSync will execute deleteSqlEditor periodically and then remove the completed item from destroyedQueryEditors on success
  • Add the logic of storing localStorage destroyedQueryEditors for persistence mode

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

before--nonblocking-close.mov

After:

after--nonblocking-close.mp4

TESTING INSTRUCTIONS

set SQLLAB_BACKEND_PERSISTENCE on
go to sqllab and then close each tab quickly

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

@dosubot dosubot bot added frontend:refactor Related to refactoring the frontend sqllab Namespace | Anything related to the SQL Lab labels Jun 12, 2024
@@ -119,6 +126,22 @@ const EditorAutoSync: FC = () => {
}
});

const syncDeletedQueryEditor = useEffectEvent(() => {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe use async/await here? I think it's more readable so feel free to apply the same pattern everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

This structure sends delete requests simultaneously, so if implemented with await, additional Promise.all handling might be required. Therefore, I intend to keep the current structure.

@justinpark justinpark merged commit ddc9f06 into apache:master Jun 14, 2024
36 of 38 checks passed
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 4.1.0 labels Nov 27, 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 frontend:refactor Related to refactoring the frontend size/L sqllab Namespace | Anything related to the SQL Lab 🚢 4.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants