BALKANGraph / FamilyTreeJS

Build family tree app with BALKAN FamilyTreeJS library. Family Tree also called a genealogy or a pedigree chart, is a chart representing family relationships in a conventional tree structure.
50 stars 16 forks source link

RemoveNode crash #50

Closed GalinaLapushinskaya closed 6 months ago

GalinaLapushinskaya commented 1 year ago

I am getting weird error when calling tree.removeNode(id). Application crashes on one specific node. I checked that deletedNode is in the list of nodes and familyTree?.canRemove(deletedNodeId) is true

familytree.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf') at push../node_modules/@balkangraph/familytree.js/familytree.js._FamilyTree.removeNode (familytree.js:1:1) at kintree.tsx:81:1 at invokePassiveEffectCreate (react-dom.development.js:23487:1) at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1) at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1) at invokeGuardedCallback (react-dom.development.js:4056:1) at flushPassiveEffectsImpl (react-dom.development.js:23574:1) at unstable_runWithPriority (scheduler.development.js:468:1) at runWithPriority$1 (react-dom.development.js:11276:1) at flushPassiveEffects (react-dom.development.js:23447:1)

The code is: if (deletedNodeId !== '' && familyTree) { familyTree.removeNode(deletedNodeId); }

Node: id:"_3zye" pid: undefined pids ['_0pn3'] rids: [_3zye'] childrenIds: ['_0pn3', '_o8ly']

ZornitsaPesheva commented 1 year ago

Please isolate the issue in a simple Code example: https://code.balkan.app/familytreejs/getting-started#JS