You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/08/20 14:15:06 UTC

[GitHub] [superset] ktmud commented on a change in pull request #16362: feat(explore): improve typing for Dnd controls and add logging

ktmud commented on a change in pull request #16362:
URL: https://github.com/apache/superset/pull/16362#discussion_r692981134



##########
File path: superset-frontend/src/explore/components/DatasourcePanel/index.tsx
##########
@@ -193,61 +194,64 @@ export default function DataSourcePanel({
   const DEFAULT_MAX_COLUMNS_LENGTH = 50;
   const DEFAULT_MAX_METRICS_LENGTH = 50;
 
-  const search = useCallback(
-    debounce((value: string) => {
-      if (value === '') {
-        setList({ columns, metrics });
-        return;
-      }
-      setList({
-        columns: matchSorter(columns, value, {
-          keys: [
-            {
-              key: 'verbose_name',
-              threshold: rankings.CONTAINS,
-            },
-            {
-              key: 'column_name',
-              threshold: rankings.CONTAINS,
-            },
-            {
-              key: item =>
-                [item.description, item.expression].map(
-                  x => x?.replace(/[_\n\s]+/g, ' ') || '',
-                ),
-              threshold: rankings.CONTAINS,
-              maxRanking: rankings.CONTAINS,
-            },
-          ],
-          keepDiacritics: true,
-        }),
-        metrics: matchSorter(metrics, value, {
-          keys: [
-            {
-              key: 'verbose_name',
-              threshold: rankings.CONTAINS,
-            },
-            {
-              key: 'metric_name',
-              threshold: rankings.CONTAINS,
-            },
-            {
-              key: item =>
-                [item.description, item.expression].map(
-                  x => x?.replace(/[_\n\s]+/g, ' ') || '',
-                ),
-              threshold: rankings.CONTAINS,
-              maxRanking: rankings.CONTAINS,
-            },
-          ],
-          keepDiacritics: true,
-          baseSort: (a, b) =>
-            Number(b.item.is_certified) - Number(a.item.is_certified) ||
-            String(a.rankedValue).localeCompare(b.rankedValue),
-        }),
-      });
-    }, FAST_DEBOUNCE),
-    [columns, metrics],
+  const search = debounce(

Review comment:
       ESLint react-hook plugin will complain not being able to detect exhaustive deps and suggests making the callback inline.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org