Does unflatten enter into infinite recursion on function or array members?
cmeeren opened this issue · 3 comments
I'm using this library in an F# project (transpiles to JS through using Fable). So unfortunately I have no JS repro (I'm not a JS dev).
unflatten
is mostly working fine, but it seems to enter into infinite recursion on some objects. This happens even when there is seemingly nothing to unflatten.
I have an array of key-value pairs (React props) that I'm converting into an object, and then I'm using unflatten
on this object.
This works fine for some prop arrays, such as this:
However, for others, such as this, it enters into an infinite recursion:
As you can see, in both cases, the original prop list (and thus the object) does not contain keys with the delimiter, and there are no sub-objects to recurse into (unless it does something with the function), so AFAIK unflatten
shouldn't modify anything.
I have tried safe
without any effect.
The weird thing is, the stack trace seems to come from the flatten
function, which I do not call:
I think perhaps the problem might be the recursion into the children
prop. I'll investigate some more.
I decided to implement my own unflatten
instead. Feel free to close if you want.