From b53fdcd147dbc8cd48c792f8a6cfccdb98130239 Mon Sep 17 00:00:00 2001 From: justinpark Date: Wed, 31 Jan 2024 10:13:03 -0800 Subject: [PATCH] fix(sqllab): autosync fail on migrated queryEditor --- 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 223ca1659156..e93538959d9b 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 175ea06ec3ec..dd48ed8c7b69 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, ),