Way to get stack trace on GoJS messages?

I’m using the debug version and getting this error. Is there a way to get GoJS to spit out a stack trace so I can quickly find out where in my code that is causing this?

Change not within a transaction: !d isTreeLeaf: Node#1495(My Delay Node that Wraps) old: false new: true

Actually, that’s not an error, but just a trace message recorded by console.log. So unfortunately you cannot break in the debugger when an exception is thrown, because there is no exception.

I suppose you could try overriding console.log to do what you want.

As the message indicates, Node.isTreeLeaf is being set to true on the Node “My Delay Node that Wraps”. Presumably the last tree child link has just been removed from that node.

It’s happening on a diagram.clear() on an existing diagram that is being refreshed from data from the server. Wrapping it in a transaction actually give another message.


The console shows:

Change not within a transaction: !d isTreeLeaf: Node#1310(Single) old: false new: true go-debug.js:28
Ending transaction without having started a transaction: buildModel go-debug.js:28

Am I do something wrong with diagram.clear()?

It doesn’t make sense to try to conduct a transaction if you are going to clear the diagram, since that discards all state from the diagram, including the model and its undoManager. http://gojs.net/latest/api/symbols/Diagram.html#clear

If you are (re)loading a diagram, just replace the Diagram.model. You don’t need to Diagram.clear() it.

I suppose it would make sense to clear() the diagram if you want it to be completely empty for a time while waiting for new content (i.e. the new model) to show up. You might also want to disable the diagram too.