mistercrunch commented on a change in pull request #6277: Avoid clearing metric
when saving from datasource editor
URL:
https://github.com/apache/incubator-superset/pull/6277#discussion_r231001058
##########
File path: superset/assets/src/explore/components/controls/MetricsControl.jsx
##########
@@ -117,8 +117,8 @@ export default class MetricsControl extends
React.PureComponent {
componentWillReceiveProps(nextProps) {
if (
- this.props.columns !== nextProps.columns ||
- this.props.savedMetrics !== nextProps.savedMetrics
+ JSON.stringify(this.props.columns) !== JSON.stringify(nextProps.columns)
||
Review comment:
I don't think `JSON.strinigfy` is good to use for deep equality:
https://stackoverflow.com/questions/15376185/is-it-fine-to-use-json-stringify-for-deep-comparisons-and-cloning
How about lodash's isEqual? https://lodash.com/docs/4.17.10#isEqual
----------------------------------------------------------------
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]