Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit d921577

Browse files
committed
Fix stacked area arity bug regression
1 parent f3dd276 commit d921577

File tree

3 files changed

+4
-47
lines changed

3 files changed

+4
-47
lines changed

packages/polaris-viz/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

88
## Unreleased
99

10+
### Fixed
11+
12+
- Fixed issue in `<StackedArea />` where changing data series length would cause the chart to throw an error
13+
1014
### Changed
1115

1216
- Removed main percentage label from `<FunnelChartNext />`

packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/StackedAreas.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,8 @@ export function StackedAreas({
8686
return (
8787
<Fragment>
8888
{stackedValues.map((data, index) => {
89-
const isSeriesLengthIncreasing =
90-
previousStackedValues &&
91-
previousStackedValues.length < stackedValues.length;
92-
9389
const dataIsValidForAnimation =
9490
!previousStackedValues ||
95-
isSeriesLengthIncreasing ||
9691
data.length === previousStackedValues[index]?.length;
9792

9893
const AreaComponent = dataIsValidForAnimation ? AnimatedArea : Area;

packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/tests/StackedAreas.test.tsx

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -100,47 +100,5 @@ describe('<StackedAreas />', () => {
100100
duration: 100,
101101
});
102102
});
103-
104-
it('renders and animates when series length changes', () => {
105-
const singleSeriesValues = [
106-
[
107-
[163, 269],
108-
[0, 0],
109-
],
110-
] as StackedSeries[];
111-
112-
const stackedArea = mount(
113-
<svg>
114-
<StackedAreas
115-
{...mockProps}
116-
stackedValues={singleSeriesValues}
117-
zeroLineValues={singleSeriesValues}
118-
/>
119-
</svg>,
120-
);
121-
122-
expect(stackedArea).toContainReactComponentTimes(AnimatedArea, 1);
123-
124-
// Update with two series
125-
stackedArea.setProps({
126-
children: (
127-
<StackedAreas
128-
{...mockProps}
129-
stackedValues={mockStackedValues}
130-
zeroLineValues={mockStackedValues}
131-
/>
132-
),
133-
});
134-
135-
const stacks = stackedArea.findAll(AnimatedArea);
136-
137-
expect(stackedArea).toContainReactComponentTimes(AnimatedArea, 2);
138-
expect(stacks[0]).toHaveReactProps({
139-
duration: 275,
140-
});
141-
expect(stacks[1]).toHaveReactProps({
142-
duration: 275,
143-
});
144-
});
145103
});
146104
});

0 commit comments

Comments
 (0)