storybook-eol / react-treebeard

React Tree View Component. Data-Driven, Fast, Efficient and Customisable.
http://storybooks.github.io/react-treebeard
MIT License
1.69k stars 294 forks source link

Lodash error #227

Open rachelaroberts opened 5 years ago

rachelaroberts commented 5 years ago

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!

maximilianoforlenza commented 5 years ago

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

Thanks

MicroDev92 commented 3 years ago

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