DataSyncSevice.syncNodeData

We found some peculiar behavior pertaining to syncNodeData in the event it was fed keys that are not found. In this case, it seems to remove the first node on the nodeDataArray. Could you clarify if that is the implementation?

For instance, this code will log the original node data array and then afterSyncNodeData is called, the second log will not include the first node on the node data array.

That seems wrong. We’ll have to investigate.

But how can that situation arise? Shouldn’t any data removals have already been processed by the diagram component, removing those keys from the diagram model?

It would be more correct for the DataSyncService to ignore the request to remove missing keys. I’ve made that change at: fix DataSyncService.syncNodeData removal of non-existent keys · NorthwoodsSoftware/gojs-angular@4dd2544 · GitHub

If this change works for you, I can publish 2.0.9.

That looks like it will do the trick. Please let us know when we can use 2.0.9 =)

But I am concerned – that situation should not happen. If the node had not been deleted before, the action is to an inconsistent state.

OK, I hope I published it correctly.

Thank you for your help. There could be something fishy going on with the state that we will have to look into.

We have a reset button that clears off any recently added nodes. When the button is pressed, the state is updated. After that point, the diagram’s modelChange function runs and the changes.removedNodeKeys are available. By when we syncNodeData with changes.removedNodeKeys, elements are removed from the synced nodes.

The modelChange function should have been called when you delete those recently-added nodes, so that your external data are up-to-date.