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 switch query editor #29108

Conversation

justinpark
Copy link
Member

SUMMARY

Following up #24539
This commit modifies the setActiveQueryEditor function to asynchronously handle the process of switching active a queryEditor in localStorage in the same way as in non-persistent mode and periodically post active state to persistence via AutoSync's updateCurrentSqlEditor.

This commit made the following changes:

  • Modified the process to remove the step of switching the activeQueryEditor based on the persistent mode in switchQueryEditor, and instead changed it to fetchQueryEditor to clearly fetch the persistent queryEditor record from the api
  • In persistence mode, changing the active tab will no longer block the query editor data until it is fetched. Instead, the tab will change and a loading state will be displayed [see the following screenshots]
  • setActiveQueryEditor has been modified to always apply to localStorage in the same way as in non-persistence mode
  • EditorAutoSync will execute updateCurrentSqlEditor periodically and then set lastUpdatedActiveTab on success
  • Add the logic of storing localStorage tabHistory for persistence mode

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

In a state of network delay

Before:

before--nonblocking-switch.mov

After:

after--nonblocking-switch.mov

TESTING INSTRUCTIONS

set SQLLAB_BACKEND_PERSISTENCE on
go to sqllab and then switch 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 6, 2024
@justinpark
Copy link
Member Author

/testenv up FEATURE_SQLLAB_BACKEND_PERSISTENCE=true

Copy link
Contributor

github-actions bot commented Jun 6, 2024

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

@justinpark justinpark force-pushed the refactor--sqllab-non-block-switch-query-editor branch from 007af56 to 3f3accb Compare June 6, 2024 23:15
@justinpark justinpark merged commit 31afb62 into apache:master Jun 12, 2024
34 checks passed
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend:refactor Related to refactoring the frontend size/L sqllab Namespace | Anything related to the SQL Lab
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants