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

graceguo 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 ec1316a  [fix] JS error after delete row level tab (#6393)
ec1316a is described below

commit ec1316a5a80b7536bcd097fc1f89cb7a161f1acd
Author: Grace Guo <grace....@airbnb.com>
AuthorDate: Thu Nov 15 10:30:08 2018 -0800

    [fix] JS error after delete row level tab (#6393)
---
 .../src/dashboard/containers/DashboardComponent.jsx  | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/superset/assets/src/dashboard/containers/DashboardComponent.jsx 
b/superset/assets/src/dashboard/containers/DashboardComponent.jsx
index c138f88..40b42ae 100644
--- a/superset/assets/src/dashboard/containers/DashboardComponent.jsx
+++ b/superset/assets/src/dashboard/containers/DashboardComponent.jsx
@@ -39,15 +39,17 @@ function mapStateToProps(
 
   // rows and columns need more data about their child dimensions
   // doing this allows us to not pass the entire component lookup to all 
Components
-  const componentType = component.type;
-  if (componentType === ROW_TYPE || componentType === COLUMN_TYPE) {
-    const { occupiedWidth, minimumWidth } = getDetailedComponentWidth({
-      id,
-      components: dashboardLayout,
-    });
+  if (component) {
+    const componentType = component.type;
+    if (componentType === ROW_TYPE || componentType === COLUMN_TYPE) {
+      const { occupiedWidth, minimumWidth } = getDetailedComponentWidth({
+        id,
+        components: dashboardLayout,
+      });
 
-    if (componentType === ROW_TYPE) props.occupiedColumnCount = occupiedWidth;
-    if (componentType === COLUMN_TYPE) props.minColumnWidth = minimumWidth;
+      if (componentType === ROW_TYPE) props.occupiedColumnCount = 
occupiedWidth;
+      if (componentType === COLUMN_TYPE) props.minColumnWidth = minimumWidth;
+    }
   }
 
   return props;
@@ -68,7 +70,7 @@ function mapDispatchToProps(dispatch) {
 class DashboardComponent extends React.PureComponent {
   render() {
     const { component } = this.props;
-    const Component = ComponentLookup[component.type];
+    const Component = component ? ComponentLookup[component.type] : null;
     return Component ? <Component {...this.props} /> : null;
   }
 }

Reply via email to