Shopify/polaris-viz

StackedAreaChart - Adding series causes chart to crash

Opened this issue · 0 comments

Bug summary

Adding new series to the data prop in the StackedAreaChart breaks it (but removing some series is OK).

Expected behavior

The chart should not break.

Actual behavior

polaris-stackedArea-crash.mp4

Steps to reproduce the problem

Here the codesandbox link: https://codesandbox.io/p/sandbox/modern-thunder-9fqny3

Solution

The exception happens at the test condition here
Adding this check solves the issue:

const dataIsValidForAnimation =
           !previousStackedValues ||
+          !previousStackedValues[index] ||
          data.length === previousStackedValues[index].length;