Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions superset-frontend/src/SqlLab/actions/sqlLab.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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',
},
];
Expand All @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions superset-frontend/src/SqlLab/actions/sqlLab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Comment thread
sadpandajoe marked this conversation as resolved.
return SupersetClient.post({
endpoint: '/tabstateview/',
Expand All @@ -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),
),
]);
Expand Down
Loading