Getting error: "_name" key in entity object is not of type string. Instead received a value of "[object Object]" with a type of "object"
This is because the function 'export function _isValidNameStr(parentStr, str)' is recieving an object as str instead of string, but why is it receiving an object? I used the given 'royals' array but it still throws this error.
Most likely you are using React with strict mode enabled. Possibly you are setting up the tree in a useEffect hook.
The issue is that tree.addEntities is being called twice. Normally, this would not be a problem, but it looks like this library MUTATES the input data (which is very naughty of it). The correct fix is to make it so this library clones the input array (or avoids mutating the input object in some other way). The workaround you can do is to simply not call tree.addEntities more than once.