You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/01/09 20:19:47 UTC

[superset] branch master updated: Closes #12389 (#12390)

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

villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 3eb0470  Closes #12389 (#12390)
3eb0470 is described below

commit 3eb0470a2fecf5c2591506394d5030ab82bef1d5
Author: Geido <60...@users.noreply.github.com>
AuthorDate: Sat Jan 9 21:18:59 2021 +0100

    Closes #12389 (#12390)
---
 .../src/datasource/ChangeDatasourceModal.tsx       | 32 ++++++++++++----------
 superset-frontend/src/explore/exploreUtils.js      |  5 ++--
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/superset-frontend/src/datasource/ChangeDatasourceModal.tsx b/superset-frontend/src/datasource/ChangeDatasourceModal.tsx
index 8e0bad3..682e83c 100644
--- a/superset-frontend/src/datasource/ChangeDatasourceModal.tsx
+++ b/superset-frontend/src/datasource/ChangeDatasourceModal.tsx
@@ -118,20 +118,24 @@ const ChangeDatasourceModal: FunctionComponent<ChangeDatasourceModalProps> = ({
     setConfirmedDataset(datasource);
   }, []);
 
-  useDebouncedEffect(() => {
-    if (filter) {
-      fetchData({
-        ...emptyRequest,
-        filters: [
-          {
-            id: 'table_name',
-            operator: 'ct',
-            value: filter,
-          },
-        ],
-      });
-    }
-  }, 1000);
+  useDebouncedEffect(
+    () => {
+      if (filter) {
+        fetchData({
+          ...emptyRequest,
+          filters: [
+            {
+              id: 'table_name',
+              operator: 'ct',
+              value: filter,
+            },
+          ],
+        });
+      }
+    },
+    1000,
+    [filter],
+  );
 
   useEffect(() => {
     const onEnterModal = async () => {
diff --git a/superset-frontend/src/explore/exploreUtils.js b/superset-frontend/src/explore/exploreUtils.js
index 68c5a6f..4304f93 100644
--- a/superset-frontend/src/explore/exploreUtils.js
+++ b/superset-frontend/src/explore/exploreUtils.js
@@ -288,8 +288,9 @@ export const exploreChart = formData => {
   postForm(url, formData);
 };
 
-export const useDebouncedEffect = (effect, delay) => {
-  const callback = useCallback(effect, [effect]);
+export const useDebouncedEffect = (effect, delay, deps) => {
+  // eslint-disable-next-line react-hooks/exhaustive-deps
+  const callback = useCallback(effect, deps);
 
   useEffect(() => {
     const handler = setTimeout(() => {