This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 7f17ba7  removes unused state values and redundant presence checks 
(#8130)
7f17ba7 is described below

commit 7f17ba7ee238516cd025031f31e39a1db8d89a9a
Author: ʈᵃᵢ <[email protected]>
AuthorDate: Thu Aug 29 21:29:34 2019 -0700

    removes unused state values and redundant presence checks (#8130)
---
 .../src/SqlLab/components/ScheduleQueryButton.jsx      | 12 ++++++------
 .../assets/src/SqlLab/components/ShareSqlLabQuery.jsx  | 10 ++++------
 .../assets/src/SqlLab/components/SqlEditorLeftBar.jsx  | 18 +++++++-----------
 superset/assets/src/components/ErrorBoundary.jsx       | 11 +++++++----
 .../src/dashboard/components/gridComponents/Chart.jsx  |  2 +-
 5 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/superset/assets/src/SqlLab/components/ScheduleQueryButton.jsx 
b/superset/assets/src/SqlLab/components/ScheduleQueryButton.jsx
index d8f82fb..09a7ddb 100644
--- a/superset/assets/src/SqlLab/components/ScheduleQueryButton.jsx
+++ b/superset/assets/src/SqlLab/components/ScheduleQueryButton.jsx
@@ -125,8 +125,8 @@ class ScheduleQueryButton extends React.PureComponent {
   onDescriptionChange(e) {
     this.setState({ description: e.target.value });
   }
-  toggleSchedule(e) {
-    this.setState({ target: e.target, showSchedule: !this.state.showSchedule 
});
+  toggleSchedule() {
+    this.setState({ showSchedule: !this.state.showSchedule });
   }
   renderModalBody() {
     return (
@@ -170,9 +170,7 @@ class ScheduleQueryButton extends React.PureComponent {
         {this.props.scheduleQueryWarning && (
           <Row>
             <Col md={12}>
-              <small>
-                {this.props.scheduleQueryWarning}
-              </small>
+              <small>{this.props.scheduleQueryWarning}</small>
             </Col>
           </Row>
         )}
@@ -183,7 +181,9 @@ class ScheduleQueryButton extends React.PureComponent {
     return (
       <span className="ScheduleQueryButton">
         <ModalTrigger
-          ref={(ref) => { this.saveModal = ref; }}
+          ref={(ref) => {
+            this.saveModal = ref;
+          }}
           modalTitle={t('Schedule Query')}
           modalBody={this.renderModalBody()}
           triggerNode={
diff --git a/superset/assets/src/SqlLab/components/ShareSqlLabQuery.jsx 
b/superset/assets/src/SqlLab/components/ShareSqlLabQuery.jsx
index dce572e..176a4fc 100644
--- a/superset/assets/src/SqlLab/components/ShareSqlLabQuery.jsx
+++ b/superset/assets/src/SqlLab/components/ShareSqlLabQuery.jsx
@@ -43,7 +43,6 @@ class ShareSqlLabQuery extends React.Component {
     super(props);
     this.state = {
       shortUrl: t('Loading ...'),
-      showOverlay: false,
     };
     this.getCopyUrl = this.getCopyUrl.bind(this);
   }
@@ -57,11 +56,10 @@ class ShareSqlLabQuery extends React.Component {
         this.setState({ shortUrl });
       })
       .catch((response) => {
-        getClientErrorObject(response)
-          .then(({ error }) => {
-            this.props.addDangerToast(error);
-            this.setState({ shortUrl: t('Error') });
-          });
+        getClientErrorObject(response).then(({ error }) => {
+          this.props.addDangerToast(error);
+          this.setState({ shortUrl: t('Error') });
+        });
       });
   }
 
diff --git a/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx 
b/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx
index bc61f83..bf7afff 100644
--- a/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx
+++ b/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx
@@ -42,12 +42,6 @@ const defaultProps = {
 export default class SqlEditorLeftBar extends React.PureComponent {
   constructor(props) {
     super(props);
-    this.state = {
-      schemaLoading: false,
-      schemaOptions: [],
-      tableLoading: false,
-      tableOptions: [],
-    };
     this.resetState = this.resetState.bind(this);
     this.onSchemaChange = this.onSchemaChange.bind(this);
     this.onSchemasLoad = this.onSchemasLoad.bind(this);
@@ -76,7 +70,10 @@ export default class SqlEditorLeftBar extends 
React.PureComponent {
   }
 
   dbMutator(data) {
-    const options = data.result.map(db => ({ value: db.id, label: 
db.database_name }));
+    const options = data.result.map(db => ({
+      value: db.id,
+      label: db.database_name,
+    }));
     this.props.actions.setDatabases(data.result);
     if (data.result.length === 0) {
       this.props.actions.addDangerToast(t("It seems you don't have access to 
any database"));
@@ -89,12 +86,10 @@ export default class SqlEditorLeftBar extends 
React.PureComponent {
   }
   changeTable(tableOpt) {
     if (!tableOpt) {
-      this.setState({ tableName: '' });
       return;
     }
     const schemaName = tableOpt.value.schema;
     const tableName = tableOpt.value.table;
-    this.setState({ tableName });
     this.props.actions.queryEditorSetSchema(this.props.queryEditor, 
schemaName);
     this.props.actions.addTable(this.props.queryEditor, tableName, schemaName);
   }
@@ -129,10 +124,11 @@ export default class SqlEditorLeftBar extends 
React.PureComponent {
             ))}
           </div>
         </div>
-        {shouldShowReset &&
+        {shouldShowReset && (
           <Button bsSize="small" bsStyle="danger" onClick={this.resetState}>
             <i className="fa fa-bomb" /> {t('Reset State')}
-          </Button>}
+          </Button>
+        )}
       </div>
     );
   }
diff --git a/superset/assets/src/components/ErrorBoundary.jsx 
b/superset/assets/src/components/ErrorBoundary.jsx
index 0f1605a..9261094 100644
--- a/superset/assets/src/components/ErrorBoundary.jsx
+++ b/superset/assets/src/components/ErrorBoundary.jsx
@@ -45,14 +45,17 @@ export default class ErrorBoundary extends React.Component {
   render() {
     const { error, info } = this.state;
     if (error) {
-      const firstLine = error ? error.toString() : null;
+      const firstLine = error.toString();
       const message = (
         <span>
-          <strong>{t('Unexpected error')}</strong>{firstLine ? `: 
${firstLine}` : ''}
-        </span>);
+          <strong>{t('Unexpected error')}</strong>
+          {firstLine ? `: ${firstLine}` : ''}
+        </span>
+      );
       if (this.props.showMessage) {
         return (
-          <StackTraceMessage message={message} stackTrace={info ? 
info.componentStack : null} />);
+          <StackTraceMessage message={message} stackTrace={info ? 
info.componentStack : null} />
+        );
       }
       return null;
     }
diff --git a/superset/assets/src/dashboard/components/gridComponents/Chart.jsx 
b/superset/assets/src/dashboard/components/gridComponents/Chart.jsx
index 61412f3..330910b 100644
--- a/superset/assets/src/dashboard/components/gridComponents/Chart.jsx
+++ b/superset/assets/src/dashboard/components/gridComponents/Chart.jsx
@@ -225,7 +225,7 @@ class Chart extends React.Component {
     const { queryResponse, chartUpdateEndTime } = chart;
     const isCached = queryResponse && queryResponse.is_cached;
     const cachedDttm = queryResponse && queryResponse.cached_dttm;
-    const isOverflowable = OVERFLOWABLE_VIZ_TYPES.has(slice && slice.viz_type);
+    const isOverflowable = OVERFLOWABLE_VIZ_TYPES.has(slice.viz_type);
 
     return (
       <div>

Reply via email to