Skip to content

Commit

Permalink
fix: fix React.Fragment complaining about width/height (apache#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Sep 4, 2019
1 parent 3cb2beb commit 3e8ca39
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions packages/superset-ui-chart/src/components/SuperChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,34 @@ export default class SuperChart extends React.PureComponent<Props, {}> {
disableErrorBoundary,
FallbackComponent,
onErrorBoundary,
Wrapper = React.Fragment,
Wrapper,
...rest
} = this.props as PropsWithDefault;

const chart = (
const chartWithoutWrapper = (
<SuperChartCore
ref={this.setRef}
id={id}
className={className}
chartType={chartType}
chartProps={this.createChartProps({
...rest,
height,
width,
})}
preTransformProps={preTransformProps}
overrideTransformProps={overrideTransformProps}
postTransformProps={postTransformProps}
onRenderSuccess={onRenderSuccess}
onRenderFailure={onRenderFailure}
/>
);
const chart = Wrapper ? (
<Wrapper width={width} height={height}>
<SuperChartCore
ref={this.setRef}
id={id}
className={className}
chartType={chartType}
chartProps={this.createChartProps({
...rest,
height,
width,
})}
preTransformProps={preTransformProps}
overrideTransformProps={overrideTransformProps}
postTransformProps={postTransformProps}
onRenderSuccess={onRenderSuccess}
onRenderFailure={onRenderFailure}
/>
{chartWithoutWrapper}
</Wrapper>
) : (
chartWithoutWrapper
);

// Include the error boundary by default unless it is specifically disabled.
Expand Down

0 comments on commit 3e8ca39

Please sign in to comment.