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 2020/07/09 01:06:07 UTC

[GitHub] [incubator-superset] ktmud commented on a change in pull request #10264: fix: optimize mapStateToProps for chart controls

ktmud commented on a change in pull request #10264:
URL: https://github.com/apache/incubator-superset/pull/10264#discussion_r451906270



##########
File path: superset-frontend/src/explore/controlUtils.js
##########
@@ -88,15 +88,17 @@ export const getControlConfig = memoizeOne(function getControlConfig(
   return control?.config || control;
 });
 
-export function applyMapStateToPropsToControl(control, state) {
-  if (control.mapStateToProps) {
-    const appliedControl = { ...control };
-    if (state) {
-      Object.assign(appliedControl, control.mapStateToProps(state, control));
-    }
-    return appliedControl;
+/**
+ * Call `mapStateToProps` from controlState and update it in place.

Review comment:
       I thought there was merit to update this in place because once a state is updated, it should never be reused. Mutation makes sure we are always referring to the same state.




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