From ec1316a5a80b7536bcd097fc1f89cb7a161f1acd Mon Sep 17 00:00:00 2001 From: Grace Guo Date: Thu, 15 Nov 2018 10:30:08 -0800 Subject: [PATCH] [fix] JS error after delete row level tab (#6393) --- .../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 c138f881d..40b42aeb1 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 ? : null; } }