You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
I replicated in shallow. I'll update the initial post with that. I haven't tried v3 (I took a quick look at the code and it seemed like this should still happen in v3 though).
I'll try to test with mount and see if it's there too.
Calling
node.children()
does not always return duplicate children (instead it removes them). It looks like this is becausechildren
usesflatMap
internally, andflatMap
dedupes its entries.Somewhat trivial test case:
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.The text was updated successfully, but these errors were encountered: