-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Description
Calling node.children() does not always return duplicate children (instead it removes them). It looks like this is because children uses flatMap internally, and flatMap dedupes its entries.
Somewhat trivial test case:
render() {
const foo = 'Foo';
return (
<div>
{foo} Bar {foo} Bar {foo}
</div>
)
}
In this case I would expect:
node.children() === ['Foo', 'Bar', 'Foo', 'Bar', 'Foo']
but instead we get:
node.children() === ['Foo', 'Bar']
I tested this in version 2.9.1, but looking at the code I think it should still exist in master.
I think the right solution is to not use de-dupe in flatMap, but I'm not sure if there's a reason that was added in to begin with.