ChristopherCFleming commented on a change in pull request #17939:
URL: https://github.com/apache/superset/pull/17939#discussion_r797929907



##########
File path: 
superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.jsx
##########
@@ -35,29 +35,24 @@ const propTypes = {
   templateParams: PropTypes.string,
 };
 
-class ExploreCtasResultsButton extends React.PureComponent {
-  constructor(props) {
-    super(props);
-    this.visualize = this.visualize.bind(this);
-    this.onClick = this.onClick.bind(this);
-  }
-
-  onClick() {
-    this.visualize();
-  }
-
-  buildVizOptions() {
-    return {
-      datasourceName: this.props.table,
-      schema: this.props.schema,
-      dbId: this.props.dbId,
-      templateParams: this.props.templateParams,
-    };
-  }
+function ExploreCtasResultsButton({
+  table,
+  schema,
+  dbId,
+  templateParams,
+  errorMessage,
+  actions,
+}) {
+  const { createCtasDatasource, addInfoToast, addDangerToast } = actions;
+  const buildVizOptions = {
+    datasourceName: table,
+    schema,
+    dbId,
+    templateParams,
+  };
 
-  visualize() {
-    this.props.actions
-      .createCtasDatasource(this.buildVizOptions())
+  const visualize = () => {
+    createCtasDatasource(buildVizOptions())

Review comment:
       Ah! Yes. We were thinking that since the original buildVizOptions just 
returns an object, why not just create that object, save it as a variable, then 
pass it as needed. Maybe I should have left it as a function?




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to