ktmud commented on a change in pull request #10293:
URL:
https://github.com/apache/incubator-superset/pull/10293#discussion_r453801198
##########
File path: superset-frontend/src/explore/controlUtils.js
##########
@@ -130,38 +149,16 @@ export function getControlStateFromControlConfig(
if (!controlConfig) {
return null;
}
- let controlState = { ...controlConfig };
+ const controlState = { ...controlConfig, value };
// only apply mapStateToProps when control states have been initialized
+ // or when explicitly didn't provide control panel state (mostly for testing)
if (
- controlPanelState &&
- (controlPanelState.controls || !controlPanelState.isInitializing)
+ (controlPanelState && controlPanelState.controls) ||
+ controlPanelState === null
) {
- controlState = applyMapStateToPropsToControl(
- controlState,
- controlPanelState,
- );
- }
-
- // If default is a function, evaluate it
- if (typeof controlState.default === 'function') {
- controlState.default = controlState.default(
- controlState,
- controlPanelState,
- );
- // if default is still a function, discard
- if (typeof controlState.default === 'function') {
- delete controlState.default;
- }
+ return applyMapStateToPropsToControl(controlState, controlPanelState);
}
Review comment:
Basically moved everything after `if` to `applyMapStateToPropsToControl`.
----------------------------------------------------------------
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]