From 76f7a3fb4ed4e820cd3f37c33c7b38f0c343f313 Mon Sep 17 00:00:00 2001 From: Lyndsi Kay Williams <55605634+lyndsiWilliams@users.noreply.github.com> Date: Wed, 15 Feb 2023 14:07:56 -0600 Subject: [PATCH] chore: Remove dependency warnings from SqlEditorLeftBar/index.tsx (#22975) --- .../components/SqlEditorLeftBar/index.tsx | 59 ++++++++++++------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx index a96cb8411..e241e3c2e 100644 --- a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx +++ b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx @@ -210,35 +210,50 @@ const SqlEditorLeftBar = ({ const shouldShowReset = window.location.search === '?reset=1'; const tableMetaDataHeight = height - 130; // 130 is the height of the selects above - const handleSchemaChange = useCallback((schema: string) => { - if (queryEditor) { - dispatch(queryEditorSetSchema(queryEditor, schema)); - } - }, []); + const handleSchemaChange = useCallback( + (schema: string) => { + if (queryEditor) { + dispatch(queryEditorSetSchema(queryEditor, schema)); + } + }, + [dispatch, queryEditor], + ); - const handleTablesLoad = useCallback((options: Array) => { - if (queryEditor) { - dispatch(queryEditorSetTableOptions(queryEditor, options)); - } - }, []); + const handleTablesLoad = useCallback( + (options: Array) => { + if (queryEditor) { + dispatch(queryEditorSetTableOptions(queryEditor, options)); + } + }, + [dispatch, queryEditor], + ); - const handleSchemasLoad = useCallback((options: Array) => { - if (queryEditor) { - dispatch(queryEditorSetSchemaOptions(queryEditor, options)); - } - }, []); + const handleSchemasLoad = useCallback( + (options: Array) => { + if (queryEditor) { + dispatch(queryEditorSetSchemaOptions(queryEditor, options)); + } + }, + [dispatch, queryEditor], + ); - const handleDbList = useCallback((result: DatabaseObject) => { - dispatch(setDatabases(result)); - }, []); + const handleDbList = useCallback( + (result: DatabaseObject) => { + dispatch(setDatabases(result)); + }, + [dispatch], + ); - const handleError = useCallback((message: string) => { - dispatch(addDangerToast(message)); - }, []); + const handleError = useCallback( + (message: string) => { + dispatch(addDangerToast(message)); + }, + [dispatch], + ); const handleResetState = useCallback(() => { dispatch(resetState()); - }, []); + }, [dispatch]); return (