diff --git a/.changeset/large-comics-repeat.md b/.changeset/large-comics-repeat.md new file mode 100644 index 000000000..d54b179cd --- /dev/null +++ b/.changeset/large-comics-repeat.md @@ -0,0 +1,5 @@ +--- +"victory-bar": patch +--- + +Fix "props.groupComponent is undefined" error diff --git a/packages/victory-bar/src/helper-methods.ts b/packages/victory-bar/src/helper-methods.ts index 0a5fe93bb..3a8de3085 100644 --- a/packages/victory-bar/src/helper-methods.ts +++ b/packages/victory-bar/src/helper-methods.ts @@ -64,7 +64,7 @@ const getCalculatedValues = (props) => { // when inside a zoom container, reset the _x and _y properties of each datum to the original // x and y property values so they will not be clipped. See https://github.com/FormidableLabs/victory/pull/2970 - if (props.groupComponent.type === VictoryClipContainer) { + if (props.groupComponent?.type === VictoryClipContainer) { data = data.map((datum) => ({ ...datum, _x: datum.x, _y: datum.y })); } diff --git a/packages/victory-bar/src/victory-bar.tsx b/packages/victory-bar/src/victory-bar.tsx index 5841568ed..fed885e7b 100644 --- a/packages/victory-bar/src/victory-bar.tsx +++ b/packages/victory-bar/src/victory-bar.tsx @@ -148,7 +148,7 @@ class VictoryBarBase extends React.Component { // when inside a zoom container (the only place VictoryClipContainer is used), all data // should be renderable so bars won't dissappear before they've fully exited the container's bounds // see https://github.com/FormidableLabs/victory/pull/2970 - if (props.groupComponent.type === VictoryClipContainer) { + if (props.groupComponent?.type === VictoryClipContainer) { children = this.renderData(props, VictoryBarBase.shouldRenderDatum); } else { children = this.renderData(props);