Skip to content

Commit

Permalink
[fix] JS error after delete row level tab (#6393)
Browse files Browse the repository at this point in the history
(cherry picked from commit ec1316a)
  • Loading branch information
Grace Guo authored and mistercrunch committed Nov 30, 2018
1 parent 7d28a84 commit 6581a82
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions superset/assets/src/dashboard/containers/DashboardComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 6581a82

Please sign in to comment.