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 new query editor #28795

Conversation

justinpark
Copy link
Member

@justinpark justinpark commented May 31, 2024

SUMMARY

Following up #24539
This commit modifies the addQueryEditor function to asynchronously handle the process of creating a queryEditor in localStorage in the same way as in non-persistent mode and periodically saving the queryEditor state to persistence via AutoSync's migrateQueryEditorFromLocalStorage.

This commit made the following changes:

  • Migrate migrateQueryEditorFromLocalStorage from the App's componentDidMount to EditorAutoSync.
  • EditorAutoSync will execute migrateQueryEditorFromLocalStorage periodically.
  • MIGRATE_QUERY_EDITOR will replace the old queryEditor at the same location instead of pushing it to the end.
  • Remove the logic of syncing localStorage tabHistory since it is already handled in the middleware.

In persistence mode, new tabs can now open and access data directly from localStorage without the delays caused by network or database latency.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

  • with network latency

Before:

before--nonblocking-creation.mov

After:

after--nonblocking-creation.mov

TESTING INSTRUCTIONS

Set SQLLAB_PERSISTENCE_MODE on and then open a multiple tabs
please reload the page and then check all tabs are persisted

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 May 31, 2024
@justinpark
Copy link
Member Author

/testenv up FEATURE_SQLLAB_BACKEND_PERSISTENCE=true

Copy link
Contributor

@justinpark Ephemeral environment spinning up at http://54.202.253.165:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

queries,
) {
return function (dispatch) {
export function migrateQueryEditorFromLocalStorage(queryEditor) {
Copy link
Member

@michael-s-molina michael-s-molina Jun 3, 2024

Choose a reason for hiding this comment

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

Is this a migration or you're syncing the query editor state with the backend? If you're syncing the state, could you rename this function to syncQueryEditor and add a JSDoc explaining that it syncs the values in the local storage with the backend?

@@ -467,7 +467,16 @@ function migrateQuery(queryId, queryEditorId, dispatch) {
);
}

export function migrateQueryEditorFromLocalStorage(queryEditor) {
/**
Copy link
Member

Choose a reason for hiding this comment

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

Nice!

@justinpark justinpark merged commit 8a8ce16 into apache:master Jun 5, 2024
31 checks passed
Copy link
Contributor

github-actions bot commented Jun 5, 2024

Ephemeral environment shutdown and build artifacts deleted.

vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
@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