Versions: Go.js 2.1.33 & Vue 2 & Nuxt 2 Issues: It is exiting the listener for initial layout / MakeUniqueKey Function and the object gets set to null. Not sure why it returns null object in event. Code: Add Model Change Listener
orgDiagram.addModelChangedListener(function (evt) {
if (!evt.isTransactionFinished) return;
var txn = evt.object;
});
Where Object comes with expanded keys
Not sure how it works in one place but doesnât in another when the code is same.
Please do help me in understanding the root cause here. Thanks in advance.
Iâm not sure what problem you are trying to show.
It is certainly the case that a transaction could execute but there are no ChangedEvents that happen. That could cause there not to be any Transaction, so the ChangedEvent.object for the âTransactionâ type ChangedEvent would be null.
I am trying to track the expanded keys using the object that is coming in the event.
When it says the transaction isnât finished and then tracks the next change - âStartingFirstTransactionâ it shows object as null. But shows the object in âMakeUniqueKeyâ. How can same event in same feature (implemented in two different places) return null in one implementation and object in another?
There are a number of âTransactionâ type ChangedEvents that are almost always ignored. I suggest that you set a breakpoint just after the second return conditional statement.
And you shouldnât set self.isModalOpen until immediately after that second return check. Setting it before that means it will get set without the execution of the rest of the code there when ChangedEvent.object is null because there were no recorded changes during the transaction so no Transaction was created to remember them.
Thank you for your response.
The issue was with undo manager. It wasnât implemented properly. Once when I enabled it, it started tracking the required transactions and changes.