youngyjd commented on a change in pull request #5767: Fix multilayer geoviz and 
color picker error
URL: 
https://github.com/apache/incubator-superset/pull/5767#discussion_r213842362
 
 

 ##########
 File path: 
superset/assets/src/visualizations/deckgl/CategoricalDeckGLContainer.jsx
 ##########
 @@ -103,7 +103,9 @@ export default class CategoricalDeckGLContainer extends 
React.PureComponent {
       data = data.filter(d => this.state.categories[d.cat_color].enabled);
     }
 
-    return [this.props.getLayer(fd, data, this.props.slice)];
+    const payload = this.props.payload;
+    payload.data.features = data;
+    return [this.props.getLayer(fd, payload, this.props.slice)];
 
 Review comment:
   A lot of good educations here! Thanks!
   The reason why I am making a copy of `this.props.payload.data.features`, 
mutating it, and then assigning it back to payload in line 107 is that if I 
understand correctly, changing in `this.props` will result in re-render. As we 
are only passing it to `getLayer` function and don't need it to be re-rendered, 
I copy it so `props` is unaffected and unnecessary re-render can be avoided. 
This is my understanding but I am not very sure whether it is correct based on 
your suggestion. Please correct me if I am wrong.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to