You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/06/29 16:15:26 UTC
(superset) branch master updated: fix(sqllab): preserve query history after tab migration (#41403)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 7926c3a93aa fix(sqllab): preserve query history after tab migration (#41403)
7926c3a93aa is described below
commit 7926c3a93aac472b14f28df8edfe6d56a83e10b4
Author: Joe Li <jo...@preset.io>
AuthorDate: Mon Jun 29 09:15:19 2026 -0700
fix(sqllab): preserve query history after tab migration (#41403)
---
.../src/SqlLab/actions/sqlLab.test.ts | 27 ++++++++++++++--------
superset-frontend/src/SqlLab/actions/sqlLab.ts | 6 ++---
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.test.ts b/superset-frontend/src/SqlLab/actions/sqlLab.test.ts
index ae53c83b77a..157aaa3d4c9 100644
--- a/superset-frontend/src/SqlLab/actions/sqlLab.test.ts
+++ b/superset-frontend/src/SqlLab/actions/sqlLab.test.ts
@@ -1843,14 +1843,26 @@ describe('async actions', () => {
{
...query,
id: 'previewOne',
- sqlEditorId: oldQueryEditor.id,
- inLocalStorage: true,
+ sqlEditorId: null,
+ isDataPreview: true,
},
{
...query,
id: 'previewTwo',
+ sqlEditorId: null,
+ isDataPreview: true,
+ },
+ {
+ ...query,
+ id: 'runningQuery',
sqlEditorId: oldQueryEditor.id,
- inLocalStorage: true,
+ state: 'running',
+ },
+ {
+ ...query,
+ id: 'unrelatedQuery',
+ sqlEditorId: 'other-editor',
+ state: 'running',
},
];
const store = mockStore({
@@ -1885,12 +1897,7 @@ describe('async actions', () => {
},
{
type: actions.MIGRATE_QUERY,
- queryId: 'previewOne',
- queryEditorId: '1',
- },
- {
- type: actions.MIGRATE_QUERY,
- queryId: 'previewTwo',
+ queryId: 'runningQuery',
queryEditorId: '1',
},
];
@@ -1900,7 +1907,7 @@ describe('async actions', () => {
expect(store.getActions()).toEqual(expectedActions);
expect(
fetchMock.callHistory.calls(updateTabStateEndpoint),
- ).toHaveLength(3);
+ ).toHaveLength(2);
// query editor has 2 tables loaded in the schema viewer
expect(
diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.ts b/superset-frontend/src/SqlLab/actions/sqlLab.ts
index 072bfd05260..8941f688929 100644
--- a/superset-frontend/src/SqlLab/actions/sqlLab.ts
+++ b/superset-frontend/src/SqlLab/actions/sqlLab.ts
@@ -689,8 +689,8 @@ export function syncQueryEditor(
(table: Table) =>
table.inLocalStorage && table.queryEditorId === queryEditor.id,
);
- const localStorageQueries = Object.values(queries).filter(
- query => query.inLocalStorage && query.sqlEditorId === queryEditor.id,
+ const queriesToMigrate = Object.values(queries).filter(
+ query => query.sqlEditorId === queryEditor.id && !query.isDataPreview,
);
return SupersetClient.post({
endpoint: '/tabstateview/',
@@ -712,7 +712,7 @@ export function syncQueryEditor(
...localStorageTables.map((table: Table) =>
migrateTable(table, newQueryEditor.tabViewId!, dispatch),
),
- ...localStorageQueries.map((query: Query) =>
+ ...queriesToMigrate.map((query: Query) =>
migrateQuery(query.id, newQueryEditor.tabViewId!, dispatch),
),
]);