chore(sqllab): Remove functionNames from sqlLab state (#24026)

This commit is contained in:
JUST.in DO IT
2023-05-23 10:42:00 -07:00
committed by GitHub
parent 8e45af43e1
commit 779b372d89
12 changed files with 161 additions and 63 deletions

View File

@@ -56,7 +56,6 @@ export default function getInitialState({
autorun: false,
templateParams: null,
dbId: defaultDbId,
functionNames: [],
queryLimit: common.conf.DEFAULT_SQLLAB_LIMIT,
validationResult: {
id: null,
@@ -87,7 +86,6 @@ export default function getInitialState({
autorun: activeTab.autorun,
templateParams: activeTab.template_params || undefined,
dbId: activeTab.database_id,
functionNames: [],
schema: activeTab.schema,
queryLimit: activeTab.query_limit,
validationResult: {

View File

@@ -563,18 +563,6 @@ export default function sqlLabReducer(state = {}, action) {
),
};
},
[actions.QUERY_EDITOR_SET_FUNCTION_NAMES]() {
return {
...state,
...alterUnsavedQueryEditorState(
state,
{
functionNames: action.functionNames,
},
action.queryEditor.id,
),
};
},
[actions.QUERY_EDITOR_SET_SCHEMA]() {
return {
...state,

View File

@@ -209,14 +209,15 @@ describe('sqlLabReducer', () => {
newState = sqlLabReducer(newState, action);
expect(newState.unsavedQueryEditor.sql).toBe(expectedSql);
const interceptedAction = {
type: actions.QUERY_EDITOR_SET_FUNCTION_NAMES,
type: actions.QUERY_EDITOR_PERSIST_HEIGHT,
queryEditor: newState.queryEditors[0],
functionNames: ['func1', 'func2'],
northPercent: 46,
southPercent: 54,
};
newState = sqlLabReducer(newState, interceptedAction);
expect(newState.unsavedQueryEditor.sql).toBe(expectedSql);
expect(newState.queryEditors[0].functionNames).toBe(
interceptedAction.functionNames,
expect(newState.queryEditors[0].northPercent).toBe(
interceptedAction.northPercent,
);
});
});