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

Family Tree with React - Remove Node doesn't work for newly created nodes #31

Open GalinaLapushinskaya opened 1 year ago

GalinaLapushinskaya commented 1 year ago

We are evaluating the component for our React project. In general component work great, but I found an issue I can't get around.

  1. Create FamilyTree like in your example using ref in useEffectHook
  2. In order to get the family tree outside of useEffect, set a state setFamilyTree(family);
  3. On node change, use sender to reset state setFamilyTree(sender) (otherwise familyTree do not see new nodes)
  4. Use this tree from the state to remove newly created node using nodeMenu Expected Result: node is removed and tree is refreshed Actual result: node stays on the tree.

I tested with old nodes and it works as expected. Also checked that node is found, but not removed. Please advice

ZornitsaPesheva commented 1 year ago

Can you get the latest version and confirm that the issue is fixed?

GalinaLapushinskaya commented 1 year ago

There is still an issue. In the new version try to create a parent for a node. Then, if you did it by mistake, try to delete it. If node has children it is marked as it cannot be deleted. The only way is to create another parent then delete the first one. Ideally we should allow to delete a node