fix: params in sql lab are jumpy in the ace editor (#16536)
* fix jumpy params
* remove cypress tests
diff --git a/superset-frontend/spec/javascripts/sqllab/actions/sqlLab_spec.js b/superset-frontend/spec/javascripts/sqllab/actions/sqlLab_spec.js
index a3f7e5b..0c424db 100644
--- a/superset-frontend/spec/javascripts/sqllab/actions/sqlLab_spec.js
+++ b/superset-frontend/spec/javascripts/sqllab/actions/sqlLab_spec.js
@@ -613,7 +613,7 @@
describe('queryEditorSetSql', () => {
describe('with backend persistence flag on', () => {
- it('does not update the tab state in the backend', () => {
+ it('updates the tab state in the backend', () => {
expect.assertions(2);
const sql = 'SELECT * ';
@@ -629,7 +629,7 @@
});
});
describe('with backend persistence flag off', () => {
- it('updates the tab state in the backend', () => {
+ it('does not update the tab state in the backend', () => {
const backendPersistenceOffMock = jest
.spyOn(featureFlags, 'isFeatureEnabled')
.mockImplementation(
diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.js b/superset-frontend/src/SqlLab/actions/sqlLab.js
index 56353ce..2cccb2e 100644
--- a/superset-frontend/src/SqlLab/actions/sqlLab.js
+++ b/superset-frontend/src/SqlLab/actions/sqlLab.js
@@ -949,6 +949,11 @@
export function queryEditorSetTemplateParams(queryEditor, templateParams) {
return function (dispatch) {
+ dispatch({
+ type: QUERY_EDITOR_SET_TEMPLATE_PARAMS,
+ queryEditor,
+ templateParams,
+ });
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.put({
endpoint: encodeURI(`/tabstateview/${queryEditor.id}`),
@@ -956,24 +961,16 @@
})
: Promise.resolve();
- return sync
- .then(() =>
- dispatch({
- type: QUERY_EDITOR_SET_TEMPLATE_PARAMS,
- queryEditor,
- templateParams,
- }),
- )
- .catch(() =>
- dispatch(
- addDangerToast(
- t(
- 'An error occurred while setting the tab template parameters. ' +
- 'Please contact your administrator.',
- ),
+ return sync.catch(() =>
+ dispatch(
+ addDangerToast(
+ t(
+ 'An error occurred while setting the tab template parameters. ' +
+ 'Please contact your administrator.',
),
),
- );
+ ),
+ );
};
}