From 3ce810fb75a76c65fb4afba5a099d73fc1db0865 Mon Sep 17 00:00:00 2001 From: Dan Labrecque <dlabrecq@redhat.com> Date: Thu, 19 Dec 2024 09:08:29 -0500 Subject: [PATCH] "props.groupComponent is undefined" error (#3014) --- .changeset/large-comics-repeat.md | 5 +++++ packages/victory-bar/src/helper-methods.ts | 2 +- packages/victory-bar/src/victory-bar.tsx | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/large-comics-repeat.md 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<VictoryBarProps> { // 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);