mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
fix: queryEditor bug (#16452)
* queryEditor bug * update tests Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
This commit is contained in:
@@ -898,16 +898,11 @@ export function updateSavedQuery(query) {
|
||||
|
||||
export function queryEditorSetSql(queryEditor, sql) {
|
||||
return function (dispatch) {
|
||||
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
|
||||
? SupersetClient.put({
|
||||
endpoint: encodeURI(`/tabstateview/${queryEditor.id}`),
|
||||
postPayload: { sql, latest_query_id: queryEditor.latestQueryId },
|
||||
})
|
||||
: Promise.resolve();
|
||||
|
||||
return sync
|
||||
.then(() => dispatch({ type: QUERY_EDITOR_SET_SQL, queryEditor, sql }))
|
||||
.catch(() =>
|
||||
if (isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)) {
|
||||
return SupersetClient.put({
|
||||
endpoint: encodeURI(`/tabstateview/${queryEditor.id}`),
|
||||
postPayload: { sql, latest_query_id: queryEditor.latestQueryId },
|
||||
}).catch(() =>
|
||||
dispatch(
|
||||
addDangerToast(
|
||||
t(
|
||||
@@ -918,6 +913,8 @@ export function queryEditorSetSql(queryEditor, sql) {
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return dispatch({ type: QUERY_EDITOR_SET_SQL, queryEditor, sql });
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user