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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]