Hello Syncfusion team,
I'm using the version of 19.3.55 the diagram control in my angular app.
The attachment has 3 files:
Thanks Aravind for investigating this. Highly appreciated.
AFAIk, the ePgHhrhFli connector ID was not set by my app, but by the syncfusion diagram component.
Thanks,
-Mithun
Hi Aravind, I've managed to reproduce the issue with Syncfusion's own diagram builder app.
Please see attached video.
At the end of the video, even though there are no connectors in the diagram, the rectangle's inedges still has reference to a connector ID.
This looks like a bug in the syncfusion diagram component.
Please let me know if any additional details are needed from my side to investigate this.
Thanks,
-Mithun
Notes
1: The repro is not 100% guaranteed, but it happens very frequently.
2: A lot of my app's users are hitting this issue frequently (the "ghost" connector in the InEdges leads to further browser exceptions while dragging/resizing etc).
3: Related forum threads: 161013
Attachment: inedge_c3fdeaf5.zip
Thanks Sivakumar, noted!
|
public collectionChange(args: ICollectionChangeEventArgs) {
if (
args.state === 'Changed' &&
args.type === 'Addition' &&
args.element instanceof Connector
) {
let obj: ConnectorModel = args.element;
let nodes: NodeModel[] = this.diagram.nodes.filter(
(node) => (node as Node).inEdges && (node as Node).inEdges.length > 0
);
for (let i: number = 0; i < nodes.length; i++) {
let node: NodeModel = nodes[i];
for (let j: number = 0; j < (node as Node).inEdges.length; j++) {
if (
(node as Node).inEdges[j] === obj.id &&
obj.targetID !== node.id
) {
(node as Node).inEdges.splice(j, 1);
}
}
}
}
} |
Hi Aravind,
Thanks for the workaround. Am trying it out now.
A quick couple of points:
Thanks,
-Mithun
Hi Aravind,
An update: I implemented a solution very similar to yours and it
seems to be working fine in my limited testing.
|
In addition to a node's inEdges, the node's port's inedges also have to be checked (in the collectionChange event handler), right?
|
Yes, we have to check the whether the node’s port inEdges has the same connector id or not. |
|
Checks have to be done for both source and target ends of the connector, right?
|
Yes, we have to check both source and target end of connector. After check the node inEdges you can check the node outEdges and connector source ID is same or not. If it is not same means then remove that connector from the node outEdges collection |
|
Wouldn't the connectionChange, or sourcePointChange / targetPointChange event handlers be better for checking (instead of collectionChange)? |
If you create an connector using port draw tool means you can use the collectionChange event. After connector gets added in the diagram and if you try to change its connection means you can use the connectionChange event. |
|
Do I have to call DiagramComponent's dataBind() or refresh() methods after removing unwanted connector IDs from the in/out Edges? |
Call the diagram dataBind method after removing the unwanted connector ID from the in/out Edges.
|
|
Will the Syncfusion DiagramComponent be patched/fixed, or should we always use above solution? |
The reported issue can be fixed in the application level, so we will not include in our source. You can use the above solution in your sample to remove the unwanted connector id in node inEdges. |