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 2018/11/15 18:30:10 UTC

[GitHub] graceguo-supercat closed pull request #6393: [fix] JS error after delete row level tab

graceguo-supercat closed pull request #6393: [fix] JS error after delete row level tab
URL: https://github.com/apache/incubator-superset/pull/6393
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/assets/src/dashboard/containers/DashboardComponent.jsx b/superset/assets/src/dashboard/containers/DashboardComponent.jsx
index c138f881d9..40b42aeb1d 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;
   }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org