Skip to content

Commit

Permalink
Fix infinite http requests
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneTorap committed Nov 14, 2022
1 parent 35de4bd commit 74f0c53
Showing 1 changed file with 22 additions and 37 deletions.
59 changes: 22 additions & 37 deletions superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,50 +214,35 @@ const SqlEditorLeftBar = ({
/>
);

const handleSchemaChange = useCallback(
(schema: string) => {
if (queryEditor) {
dispatch(queryEditorSetSchema(queryEditor, schema));
}
},
[dispatch, queryEditor],
);
const handleSchemaChange = useCallback((schema: string) => {
if (queryEditor) {
dispatch(queryEditorSetSchema(queryEditor, schema));
}
}, []);

const handleTablesLoad = useCallback(
(options: Array<any>) => {
if (queryEditor) {
dispatch(queryEditorSetTableOptions(queryEditor, options));
}
},
[dispatch, queryEditor],
);
const handleTablesLoad = useCallback((options: Array<any>) => {
if (queryEditor) {
dispatch(queryEditorSetTableOptions(queryEditor, options));
}
}, []);

const handleSchemasLoad = useCallback(
(options: Array<any>) => {
if (queryEditor) {
dispatch(queryEditorSetSchemaOptions(queryEditor, options));
}
},
[dispatch, queryEditor],
);
const handleSchemasLoad = useCallback((options: Array<any>) => {
if (queryEditor) {
dispatch(queryEditorSetSchemaOptions(queryEditor, options));
}
}, []);

const handleDbList = useCallback(
(result: DatabaseObject) => {
dispatch(setDatabases(result));
},
[dispatch],
);
const handleDbList = useCallback((result: DatabaseObject) => {
dispatch(setDatabases(result));
}, []);

const handleError = useCallback(
(message: string) => {
dispatch(addDangerToast(message));
},
[dispatch],
);
const handleError = useCallback((message: string) => {
dispatch(addDangerToast(message));
}, []);

const handleResetState = useCallback(() => {
dispatch(resetState());
}, [dispatch]);
}, []);

return (
<div data-test="sql-editor-left-bar" className="SqlEditorLeftBar">
Expand Down

0 comments on commit 74f0c53

Please sign in to comment.