fix(sqllab): preserve query history after tab migration#41403
fix(sqllab): preserve query history after tab migration#41403sadpandajoe wants to merge 2 commits into
Conversation
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41403 +/- ##
==========================================
- Coverage 64.37% 64.37% -0.01%
==========================================
Files 2653 2653
Lines 145152 145152
Branches 33491 33491
==========================================
- Hits 93446 93440 -6
- Misses 50014 50020 +6
Partials 1692 1692
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes a SQL Lab state migration edge case where Query History could appear empty after running a query in a newly-cloned tab that transitions from a temporary local editor id to a persisted backend tab id.
Changes:
- Update
syncQueryEditorto migrate all non-preview queries associated with the local editor id (not just those markedinLocalStorage). - Add a regression test case covering a running query that is not marked
inLocalStorage, ensuring it gets migrated during tab persistence.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| superset-frontend/src/SqlLab/actions/sqlLab.ts | Expands query migration criteria during tab persistence to include non-inLocalStorage non-preview queries tied to the local editor id. |
| superset-frontend/src/SqlLab/actions/sqlLab.test.ts | Extends syncQueryEditor thunk coverage to include migrating a running query that is not marked inLocalStorage. |
|
The suggestion to update the superset-frontend/src/SqlLab/actions/sqlLab.test.ts |
SUMMARY
Fixes the SQL Lab query history pane becoming empty after running a query in a new tab from Query History.
When a new SQL Lab tab is created locally and then persisted to the backend, the editor id changes from the temporary local id to the backend tab id.
syncQueryEditoronly migrated queries that were marked asinLocalStorage, so a just-started query from an autorun cloned tab could stay attached to the old local editor id. The Query History pane then filtered by the backend tab id and no longer found the query.This updates tab sync to migrate all non-preview queries attached to the local editor id, and adds regression coverage for a running query that is not marked
inLocalStorage.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A. Behavior-only SQL Lab state fix.
TESTING INSTRUCTIONS
Automated/local checks run:
npm run test -- src/SqlLab/actions/sqlLab.test.ts --runTestsByPathnpm run lint -- src/SqlLab/actions/sqlLab.ts src/SqlLab/actions/sqlLab.test.tspre-commit run --files superset-frontend/src/SqlLab/actions/sqlLab.ts superset-frontend/src/SqlLab/actions/sqlLab.test.tsgit diff --checkNote:
pre-commit run --all-fileswas run before pushing, but this local worktree did not complete green because of unrelated baseline/environment blockers outside this diff, including existing mypy/ruff failures in unrelated Python files and missing local all-files tooling/build prerequisites (yarn,helm-docs, and package build artifacts before local package build).ADDITIONAL INFORMATION
SQLLAB_BACKEND_PERSISTENCE