Cannot read property 'id' of undefined at DiagramComponent.drag

Hello Syncfusion team,

Occasionally, I encounter the below error when attempting to drag a node. 

core.js:4610 ERROR TypeError: Cannot read property 'id' of undefined
    at DiagramComponent.drag (ej2-diagrams.es2015.js:35307)
    at CommandHandler.dragSelectedObjects (ej2-diagrams.es2015.js:31953)
    at MoveTool.mouseMove (ej2-diagrams.es2015.js:23828)
    at DiagramEventHandler.checkAutoScroll (ej2-diagrams.es2015.js:26171)
    at DiagramEventHandler.mouseMoveExtend (ej2-diagrams.es2015.js:25968)
    at DiagramEventHandler.mouseMove (ej2-diagrams.es2015.js:26132)
    at ZoneDelegate.invokeTask (zone-evergreen.js:399)
    at Object.onInvokeTask (core.js:28183)
    at ZoneDelegate.invokeTask (zone-evergreen.js:398)
    at Zone.runTask (zone-evergreen.js:167)

The diagram JSON is attached.

Also please see the attached GIF files.

1: While dragging the node, the node moves too fast (relative to the mouse movement). 

2: Also observing some weirdness with node selection area after I select the node and scroll using mousewheel up/down.

This issue occurs even with the latest (18.4.31) @syncfusion/ej2-angular-diagrams package.

Please let me know if any additional information is needed to troubleshoot this issue.

Thanks,
-Mithun

 

Attachment: syncfusiondragissue_6f2fa4c8.zip

3 Replies 1 reply marked as answer

AR Aravind Ravi Syncfusion Team December 30, 2020 04:27 PM UTC

Hi Mithun, 
 
On analyzing the provided JSON data,  there is no connector in the diagram and JSON data. But in the node InEdges property there is a connector id present in it. But connector with that id does not present in the diagram. So that the reported issue occurs. So please remove the connector id from the node inEdges property.  
 
//remove the connector collection from node inedges 
"inEdges": [ 
                 
            ], 
            "outEdges": [], 
            "parentId": "", 
            "processId": "", 
            "umlIndex": -1, 
            "isPhase": false, 
            "isLane": false 
 
We have attached a video demonstration that after we remove the node inedges , the node has been dragged properly. Please refer to the below video 
 
 
Regards 
Aravind Ravi 


Marked as answer

MI Mithun December 31, 2020 11:40 AM UTC

Thanks Aravind! That worked. 

I've occasionally encountered some issues with malformed diagram JSON (another example here). 

Is there any API to validate the diagram JSON? Ideally I'd like DiagramComponent's LoadDiagram() method to do this.

Would it be possible to file a feature request for this.

Thanks,
-Mithun
 


GG Gowtham Gunashekar Syncfusion Team January 4, 2021 12:40 PM UTC

Hi Mithun, 
The code which you have mentioned in the forum 149983 has more critical code snippets it may affect other functionalities of diagram. So we would be better to use such code at your sample side. 
Regards,  
Gowtham G 
 


Loader.
Up arrow icon