michellethomas closed pull request #6277: Avoid clearing metric when saving
from datasource editor
URL: https://github.com/apache/incubator-superset/pull/6277
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/superset/assets/src/explore/components/controls/MetricsControl.jsx
b/superset/assets/src/explore/components/controls/MetricsControl.jsx
index 7bbb4d111b..f820dc8c7d 100644
--- a/superset/assets/src/explore/components/controls/MetricsControl.jsx
+++ b/superset/assets/src/explore/components/controls/MetricsControl.jsx
@@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import VirtualizedSelect from 'react-virtualized-select';
import { t } from '@superset-ui/translation';
+import { isEqual } from 'lodash';
import ControlHeader from '../ControlHeader';
import VirtualizedRendererWrap from
'../../../components/VirtualizedRendererWrap';
@@ -117,8 +118,8 @@ export default class MetricsControl extends
React.PureComponent {
componentWillReceiveProps(nextProps) {
if (
- this.props.columns !== nextProps.columns ||
- this.props.savedMetrics !== nextProps.savedMetrics
+ isEqual(this.props.columns) !== isEqual(nextProps.columns) ||
+ isEqual(this.props.savedMetrics) !== isEqual(nextProps.savedMetrics)
) {
this.setState({ options: this.optionsForSelect(nextProps) });
this.props.onChange([]);
----------------------------------------------------------------
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]