From 17aa844d19d87caf8b763cb07d3ea6ddc7c05d9c Mon Sep 17 00:00:00 2001 From: Mark McDowell Date: Fri, 28 Aug 2020 00:23:47 +0100 Subject: [PATCH] fix(core): children can be undefined or null Checking for null children for the chart. --- packages/core/src/utils/ChartDataUtil.ts | 2 +- packages/stories/src/features/axis/Axis.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/utils/ChartDataUtil.ts b/packages/core/src/utils/ChartDataUtil.ts index e63401804..e7c9e570c 100644 --- a/packages/core/src/utils/ChartDataUtil.ts +++ b/packages/core/src/utils/ChartDataUtil.ts @@ -67,7 +67,7 @@ const isChartProps = (props: ChartProps | any | undefined): props is ChartProps export function getNewChartConfig(innerDimension: any, children: any, existingChartConfig: any[] = []) { return React.Children.map(children, (each) => { - if (each !== undefined && isChartProps(each.props)) { + if (each !== undefined && each !== null && isChartProps(each.props)) { const chartProps = { ...Chart.defaultProps, ...each.props, diff --git a/packages/stories/src/features/axis/Axis.tsx b/packages/stories/src/features/axis/Axis.tsx index 90445114e..97208f8e8 100644 --- a/packages/stories/src/features/axis/Axis.tsx +++ b/packages/stories/src/features/axis/Axis.tsx @@ -54,9 +54,9 @@ class AxisExample extends React.Component { xExtents={xExtents} > - + );