Closed BekaBaydullaev closed 1 year ago
I am not exactly sure what is happening, if you can provide an online reproducible example by forking the react integration sample, I may be able to check it
I am not exactly sure what is happening, if you can provide an online reproducible example by forking the react integration sample, I may be able to check it
Any update regarding this issues ? 😅
Not expecting updates in the coming days (maybe weeks or even months?)
I'll look into it once I will have more free time from my current projects
Hmm:/ I checked this example and it was working for me
Hi! In the "React Integration" example there is a button to add a new node with "hard-coded " values, so I assumed that if I pass values of the node like: "id", "name" and "parentNodeId" from the user input it will create a new node, but it throws an error "Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'filter')" which leads to the line 492 of "d3-org-chart" file where:
const nodeFound = attrs.allNodes.filter(({ data }) => attrs.nodeId(data) === attrs.nodeId(obj))[0];
.Another thing is even if I call the "addNode" function from other places, like a button that is in the mui drawer or dialog box it also show same error, although I'm not passing new values, its still using same "hard-coded" values from the example.
After some playing around, I decided to put all the code into one file, guessing that this error could be caused due to wrong declaration of the OrgChart or wrong data parsing from the json file, but still the same error.
So the question is how to properly use addNode function to create a new node using values provided by a user?
I will add the whole code for better picture of what I'm trying to do.
P.S. I'm a newbie to react development, so please don't mind my bad coding 😅
Thanks in advance
=================Code that I'm trying to make work==================