It works but one side-effect is the selected node goes away plus I’m guessing it’s inefficient. I’m wondering if there is a way to apply the changes from nextProps.nodeDataArray to the current model.nodeDataArray? The only difference between the two is one node will have the name changed but in this code I don’t know which node that is. Any advice on a better way to handle this?
If not then I guess I can get the current selection, do the code above, then re-apply the selection.
Walter I added those calls and my handleModelChange is now getting called on commitTransaction() when it wasn’t before and causing problems. I can’t remember why I didn’t want that called but will look into it. Here is my complete code snippet.
Based on your calls to removeModelChangedListener and addModelChangedListener, I imagine you didn’t want your handleModelChange called because you were trying to prevent update cycles. What happens if you place those calls outside the transaction?
You can also prevent cycles by ensuring the model changes aren’t already reflected in your data via comparison, or maybe using some sort of flag to indicate the GoJS model is being updated with current data and not to execute in the handleModelChange function.