mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
fix: params in sql lab are jumpy in the ace editor (#16536)
* fix jumpy params * remove cypress tests
This commit is contained in:
committed by
GitHub
parent
37c2020035
commit
519baa6f00
@@ -613,7 +613,7 @@ describe('async actions', () => {
|
||||
|
||||
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('async actions', () => {
|
||||
});
|
||||
});
|
||||
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(
|
||||
|
||||
@@ -949,6 +949,11 @@ export function queryEditorSetQueryLimit(queryEditor, queryLimit) {
|
||||
|
||||
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 @@ export function queryEditorSetTemplateParams(queryEditor, templateParams) {
|
||||
})
|
||||
: 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.',
|
||||
),
|
||||
),
|
||||
);
|
||||
),
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user