diff --git a/superset-frontend/src/SqlLab/App.jsx b/superset-frontend/src/SqlLab/App.jsx index 90de0a4d0140..39f784a5c57f 100644 --- a/superset-frontend/src/SqlLab/App.jsx +++ b/superset-frontend/src/SqlLab/App.jsx @@ -95,7 +95,7 @@ const sqlLabPersistStateConfig = { ...initialState, ...persistedState, sqlLab: { - ...(persistedState && persistedState.sqlLab), + ...(persistedState?.sqlLab || {}), // Overwrite initialState over persistedState for sqlLab // since a logic in getInitialState overrides the value from persistedState ...initialState.sqlLab, diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.js b/superset-frontend/src/SqlLab/actions/sqlLab.js index d29ef96566b4..8e397b075a18 100644 --- a/superset-frontend/src/SqlLab/actions/sqlLab.js +++ b/superset-frontend/src/SqlLab/actions/sqlLab.js @@ -383,7 +383,7 @@ export function runQueryFromSqlEditor( const qe = getUpToDateQuery(getState(), queryEditor, queryEditor.id); const query = { dbId: qe.dbId, - sql: qe.selectedText ? qe.selectedText : qe.sql, + sql: qe.selectedText || qe.sql, sqlEditorId: qe.id, tab: qe.name, schema: qe.schema,