react-treebeard icon indicating copy to clipboard operation
react-treebeard copied to clipboard

Lodash error

Open rachelaroberts opened this issue 6 years ago • 2 comments

Hello, when I try to view my treebeard component in chrome, I receive the following the error in the console:

TypeError: (0, _lodash.castArray) is not a function (bundle.js:1235) at TreeBeard (bundle.js:90263)

I’ve tried updating some dependencies to their latest versions, but it is still occurring. Does anyone know where this could be coming from?

Thank you in advance!

rachelaroberts avatar Aug 05 '19 16:08 rachelaroberts

Hi @rachelaroberts ! Could you please upload an example? (codesanbox)

Thanks

maximilianoforlenza avatar Aug 18 '19 13:08 maximilianoforlenza

Hi, I have been having the same issue since recently, I haven't updated or modified my code, it worked for a year up until now.... IMPLEMENTATION: const TreeExample = (props) => { const [counter, setCounter] = useState(0); const [data, setData] = useState({}); const [cursor, setCursor] = useState(false);

useEffect(() => { const getUsers = async () => { const result = await axios( "example.org/data" ); let pom = result.data[0]; setData(pom); }; getUsers(); }, []);

const onToggle = (node, toggled) => {

if (cursor) {
  cursor.active = false;
}
node.active = true;
if (node.children) {
  node.toggled = toggled;
}
setCursor(node);
setData(Object.assign({}, data));

};

return Treebeard data={data} onToggle={onToggle} ; }; as I said, this worked for a year until a few days ago... P.S. I intentionally removed enclosing tags in return statement because it wasn't visible. P.P.S. Also tried with Your demo data and the same error is returned

MicroDev92 avatar Mar 22 '21 18:03 MicroDev92