You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ly...@apache.org on 2023/02/03 01:07:01 UTC

[superset] 01/01: Fix dependency warnings in SqlEditorLeftBar/index.tsx

This is an automated email from the ASF dual-hosted git repository.

lyndsi pushed a commit to branch lyndsi/fix-SqlEditorLeftBar-dependency-warnings
in repository https://gitbox.apache.org/repos/asf/superset.git

commit aa42f2a3f3c3601f3ad7f634a59d24e8289bebbe
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Feb 2 19:06:36 2023 -0600

    Fix dependency warnings in SqlEditorLeftBar/index.tsx
---
 .../SqlLab/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 a96cb84116..e241e3c2e2 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<any>) => {
-    if (queryEditor) {
-      dispatch(queryEditorSetTableOptions(queryEditor, options));
-    }
-  }, []);
+  const handleTablesLoad = useCallback(
+    (options: Array<any>) => {
+      if (queryEditor) {
+        dispatch(queryEditorSetTableOptions(queryEditor, options));
+      }
+    },
+    [dispatch, queryEditor],
+  );
 
-  const handleSchemasLoad = useCallback((options: Array<any>) => {
-    if (queryEditor) {
-      dispatch(queryEditorSetSchemaOptions(queryEditor, options));
-    }
-  }, []);
+  const handleSchemasLoad = useCallback(
+    (options: Array<any>) => {
+      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 (
     <LeftBarStyles data-test="sql-editor-left-bar">