From 62993c2fbaeaca6759c98efdc9a8853d91093802 Mon Sep 17 00:00:00 2001 From: "JUST.in DO IT" Date: Wed, 31 Jan 2024 11:19:55 -0800 Subject: [PATCH] fix(sqllab): autosync fail on migrated queryEditor (#26922) --- superset-frontend/src/SqlLab/actions/sqlLab.js | 1 + superset-frontend/src/SqlLab/actions/sqlLab.test.js | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.js b/superset-frontend/src/SqlLab/actions/sqlLab.js index 223ca16591..e93538959d 100644 --- a/superset-frontend/src/SqlLab/actions/sqlLab.js +++ b/superset-frontend/src/SqlLab/actions/sqlLab.js @@ -477,6 +477,7 @@ export function migrateQueryEditorFromLocalStorage( const newQueryEditor = { ...queryEditor, id: json.id.toString(), + inLocalStorage: false, }; dispatch({ type: MIGRATE_QUERY_EDITOR, diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.test.js b/superset-frontend/src/SqlLab/actions/sqlLab.test.js index 175ea06ec3..dd48ed8c7b 100644 --- a/superset-frontend/src/SqlLab/actions/sqlLab.test.js +++ b/superset-frontend/src/SqlLab/actions/sqlLab.test.js @@ -937,12 +937,17 @@ describe('async actions', () => { { ...query, id: 'previewTwo' }, ]; const store = mockStore({}); + const oldQueryEditor = { ...queryEditor, inLocalStorage: true }; const expectedActions = [ { type: actions.MIGRATE_QUERY_EDITOR, - oldQueryEditor: queryEditor, + oldQueryEditor, // new qe has a different id - newQueryEditor: { ...queryEditor, id: '1' }, + newQueryEditor: { + ...oldQueryEditor, + id: '1', + inLocalStorage: false, + }, }, { type: actions.MIGRATE_TAB_HISTORY, @@ -975,7 +980,7 @@ describe('async actions', () => { return store .dispatch( actions.migrateQueryEditorFromLocalStorage( - queryEditor, + oldQueryEditor, tables, queries, ),