The scenario is when one user is viewing diagram X, and someone else is editing this diagram,
I want to re-render the changes for the viewer.
For doing that, I used socket.io for listening to updates of the diagram from the server.
When it has changed, the socket receives the nodeDataArray and linkDataArray.
But it is not working well.
Sometimes, the diagram re-rendered but I got an error at the console of "Cannot read property 'layer' of null" and sometimes the view is not refreshed at all.
Just setting a DiagramComponent’s @Input property should cause it to update. When you set its nodeDataArray, does it call the mergeChanges function in gojs-angular?
How to debug is not what I am asking… I don’t know how to access this file and find this function.
I tried to look for this file in node-modules in gojs-angular folder - but I didn’t found it…
Do you have any example of angular, except the basic sample, that shows how to update data of the diagram?
In the debugger you should be able to find the loaded .js file compiled from that diagram.component.ts file, which should be in your project somewhere.
That gojs-angular compiled file must be loaded somehow, somewhere. I don’t know what else to say.
I suppose you could define a “LayoutCompleted” DiagramEvent listener that will be called after the transaction that accepts the new data completes. But that won’t be called if that gojs-angular mergeChanges function or ngDoCheck method isn’t being called.
Ok, after you mention skipsDiagramUpdate, I checked the diagramModelChange function.
I found that diagramModelChange being calling with changes event with a null value, several times.
(I think it is happening because I have logic that changes the nodes frame color every x seconds due to some logic)
If I surround the function code with If statement with the term that changes will be not null, the following things are happening:
If I am adding/deleting nodes, the LayoutCompleted called and the diagram was re-rendered.
But, I am also getting an error at gojs-angular.js:226 - its trying to remove a node that has a null value and then throws an exception
The code is: dc.diagram.remove(node);
If I just moving nodes to a different location, the LayoutCompleted event not called, the diagram is not re-renderd, and I also have the same error as before.
Any idea why the code acts in that way?
Thank you!!
We’re looking at the exception that you’re getting.
So you have the location information on the node data object? Does your node template have a Binding on the Node.location with that data property as a source?