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

Saving state to the database is broken when user adds new member (FamilyTree) #44

Closed GalinaLapushinskaya closed 6 months ago

GalinaLapushinskaya commented 1 year ago

Hello, In our application we are saving nodes for the tree and state for the tree in the database. To do that, we handle tree update with the handler tree.on('update', treeChangeHandle); There we are tracking added/edited/deleted nodes and update our list of nodes accordingly. We also sync state with the local storage, so when user clicks Save, we save the changes to the database: both nodes and state. What we noticed, that if user clicks "Add Member" on one of the nodes, and then clicks Save, the tree breaks on load after that. It happens because State starts to have extra nodes like "_ft_father" or "ft_mother", but this nodes actually do not exist. Sometimes it add these temp nodes to some of the mandatory IDs, but the actual nodes are not there, so on the next load, the tree just breaks. Please advise the best approach. Thanks

ZornitsaPesheva commented 1 year ago

Hi I am not sure what State you mean. If you mean this state: https://balkan.app/FamilyTreeJS/Docs/State we had an issue that was fixed. If not could you please reproduce the issue in Code: https://code.balkan.app/family-tree-js/getting-started#JS