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 2022/01/14 22:41:48 UTC

[GitHub] [superset] lyndsiWilliams commented on a change in pull request #17939: refactor(ExploreCtasResultsButton): convert to functional component

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



##########
File path: superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.jsx
##########
@@ -68,39 +62,35 @@ class ExploreCtasResultsButton extends React.PureComponent {
           all_columns: [],
           row_limit: 1000,
         };
-        this.props.actions.addInfoToast(
-          t('Creating a data source and creating a new tab'),
-        );
+        addInfoToast(t('Creating a data source and creating a new tab'));
 
         // open new window for data visualization
         exploreChart(formData);
       })
       .catch(() => {
-        this.props.actions.addDangerToast(
-          this.props.errorMessage || t('An error occurred'),
-        );
+        addDangerToast(errorMessage || t('An error occurred'));
       });
-  }
+  };
 
-  render() {
-    return (
-      <>
-        <Button
-          buttonSize="small"
-          onClick={this.onClick}
-          tooltip={t('Explore the result set in the data exploration view')}
-        >
-          <InfoTooltipWithTrigger
-            icon="line-chart"
-            placement="top"
-            label="explore"
-          />{' '}
-          {t('Explore')}
-        </Button>
-      </>
-    );
-  }
-}
+  const onClick = () => {
+    visualize();
+  };
+
+  return (
+    <Button
+      buttonSize="small"
+      onClick={onClick}

Review comment:
       ```suggestion
     return (
       <Button
         buttonSize="small"
         onClick={visualize}
   ```
   Since this is only running visualize(), you can delete this function and pass visualize() straight into the onClick attribute.




-- 
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: notifications-unsubscribe@superset.apache.org

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