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 2021/01/26 07:47:37 UTC

[GitHub] [superset] villebro commented on a change in pull request #12747: feat(explore): Make metric title respond to changes immediately

villebro commented on a change in pull request #12747:
URL: https://github.com/apache/superset/pull/12747#discussion_r564304842



##########
File path: superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricPopoverTrigger.tsx
##########
@@ -27,7 +27,10 @@ import { savedMetricType } from './types';
 
 export type AdhocMetricPopoverTriggerProps = {
   adhocMetric: AdhocMetric;
-  onMetricEdit: () => void;
+  onMetricEdit(
+    newMetric: AdhocMetric | Record<string, any>,
+    oldMetric: AdhocMetric | Record<string, any>,

Review comment:
       Is `Record<string, any>` for saved metrics here? Could this be `savedMetricType`? (Unrelated bycatch, this type should probably be called `SavedMetricType`)

##########
File path: superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover.jsx
##########
@@ -110,20 +107,26 @@ export default class AdhocMetricEditPopover extends React.Component {
     this.props.getCurrentTab(this.defaultActiveTabKey);
   }
 
+  componentDidUpdate(prevProps, prevState) {
+    if (
+      prevState.adhocMetric?.label !== this.state.adhocMetric?.label ||
+      prevState.savedMetric?.metric_name !== this.state.savedMetric?.metric_name

Review comment:
       do we need to add a `prevState.savedMetric?.verbose_name !== this.state.savedMetric?.verbose_name` here?




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