superset-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-superset] mistercrunch commented on a change in pull request #10889: ESLint: no-restricted-syntax
Date Wed, 16 Sep 2020 15:39:21 GMT

mistercrunch commented on a change in pull request #10889:
URL: https://github.com/apache/incubator-superset/pull/10889#discussion_r489536177



##########
File path: superset-frontend/src/explore/controlUtils.js
##########
@@ -52,21 +52,18 @@ export function validateControl(control, processedState) {
  * Find control item from control panel config.
  */
 function findControlItem(controlPanelSections, controlKey) {
-  for (const section of controlPanelSections) {
-    for (const controlArr of section.controlSetRows) {
-      for (const control of controlArr) {
-        if (controlKey === control) return control;
-        if (
-          control !== null &&
-          typeof control === 'object' &&
-          control.name === controlKey
-        ) {
-          return control;
-        }
-      }
-    }
-  }
-  return null;
+  return (

Review comment:
       This one is much more opaque to me and this seems more risky than the other pieces
of logic in this PR.  I checked and there is not unit test on this method. Can we either 1)
write a covering unit test that works before/after or 2) minimize the changes. 
   
   It looks like there are existing fixtures for `controlPanelSections` that can be refactored
out of superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx . 




----------------------------------------------------------------
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.

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


Mime
View raw message