diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.js b/superset-frontend/src/SqlLab/actions/sqlLab.js index 2605c43e739f..9485cfb650ca 100644 --- a/superset-frontend/src/SqlLab/actions/sqlLab.js +++ b/superset-frontend/src/SqlLab/actions/sqlLab.js @@ -776,12 +776,14 @@ export function queryEditorSetDb(queryEditor, dbId) { export function queryEditorSetSchema(queryEditor, schema) { return function (dispatch) { - const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE) - ? SupersetClient.put({ - endpoint: encodeURI(`/tabstateview/${queryEditor.id}`), - postPayload: { schema }, - }) - : Promise.resolve(); + const sync = + isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE) && + typeof queryEditor === 'object' + ? SupersetClient.put({ + endpoint: encodeURI(`/tabstateview/${queryEditor.id}`), + postPayload: { schema }, + }) + : Promise.resolve(); return sync .then(() =>