uber/react-vis

react-vis 0.3.1 XYPlot fails on nested child array

ibgreen opened this issue · 3 comments

Tried to upgrade from 0.1.1 to 0.3.1 but had to revert.

Got a crash in collectSeriesTypesInfo when it tried to process my application's nested array of XYPlot children.

Perhaps some higher level code is not first calling getSeriesChildren?

@ibgreen could you put an example of what you mean by nested child array? A minimum reproducible example help us track this down and ensure that we resolve the issue.

@chrisirhc In my app, props.children is an array contain a mix of react elements and arrays containing additional react elements. Conceptually something like:

  props.children = [
    LineSeries,
    LineSeries,
    [ Hint, Hint ],
];

Normally props.children is considered an opaque data type and a component should use the React.Children utilities to deal with props.children
I debugged a bit further and the problem happens when the XYPlot is constructed.

The constructor calls getStackedData which does not call React.Children utilities but tries to iterate directly on props.children

Fixed in #57 , waiting for the review.