I am using the diagram clicked event as below. When I click on the diagram background, the connection to the server is lost and an error appears in the Chrome console (see below). However, if I click on a node on the diagram, this behavior does not occur. This occurs when there is no code in the event handler so it is not my code inside the handler.
I want to reset my selected node variable (type custom class) to null when the user clicks on the background of the diagram.
public void DiagramClicked(IBlazorClickEventArgs args)
{
//if (args.ActualObject.Diagram != null)
//{
// SelectedNode = null;
//}
}
<SfDiagram @ref="@Diagram" Height="750px" Width="@DiagramWidth" Nodes="@NodeCollection" Connectors="@ConnectorCollection" Tool="@tool">
<DiagramEvents DragEnter="@OnDrop" SelectionChanged="@OnSelectionChanged" Clicked="@DiagramClicked"></DiagramEvents>
<DiagramPageSettings>
<DiagramFitOptions CanFit="true" Mode="@FitModes.Page"></DiagramFitOptions>
</DiagramPageSettings>
</SfDiagram>
blazor.server.js:1 [2020-09-07T17:02:55.281Z] Error: Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error.'.
e.log @ blazor.server.js:1
e.stopConnection @ blazor.server.js:1
transport.onclose @ blazor.server.js:1
e.close @ blazor.server.js:1
e.stop @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
a @ blazor.server.js:1
Promise.then (async)
c @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
M @ blazor.server.js:1
e.stopInternal @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
(anonymous) @ blazor.server.js:1
M @ blazor.server.js:1
e.stop @ blazor.server.js:1
e.processIncomingData @ blazor.server.js:1
connection.onreceive @ blazor.server.js:1
i.onmessage @ blazor.server.js:1
blazor.server.js:1 [2020-09-07T17:02:58.283Z] Information: Normalizing '_blazor' to 'https://localhost:44324/_blazor'.
blazor.server.js:1 [2020-09-07T17:02:58.297Z] Information: WebSocket connected to wss://localhost:44324/_blazor?id=DhAWaYnQWIpONgM7YCEBQQ.