Skip to content

Commit

Permalink
fix(sqllab): autosync fail on migrated queryEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpark committed Jan 31, 2024
1 parent 31eed00 commit b53fdcd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions superset-frontend/src/SqlLab/actions/sqlLab.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ export function migrateQueryEditorFromLocalStorage(
const newQueryEditor = {
...queryEditor,
id: json.id.toString(),
inLocalStorage: false,
};
dispatch({
type: MIGRATE_QUERY_EDITOR,
Expand Down
11 changes: 8 additions & 3 deletions superset-frontend/src/SqlLab/actions/sqlLab.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -975,7 +980,7 @@ describe('async actions', () => {
return store
.dispatch(
actions.migrateQueryEditorFromLocalStorage(
queryEditor,
oldQueryEditor,
tables,
queries,
),
Expand Down

0 comments on commit b53fdcd

Please sign in to comment.