You probably should not be depending on the value of the node data key to determine whether or not you have “duplicates”.
Would it be OK for your app to remove any just-dropped nodes that duplicate previously existing nodes? Say your node data has a property named “color”, and you wanted to make sure each node had a unique color. Then you could do something like:
$(go.Diagram, "myDiagramDiv",
{
allowDrop: true,
"ExternalObjectsDropped": function(e) {
e.subject.copy().each(function(n) {
var matching = e.diagram.findNodesByExample({ color: n.data.color });
if (matching.count > 1) e.diagram.remove(n);
})
},
. . .
Note how that for the “ExternalObjectsDropped” DiagramEvent, the DiagramEvent.subject is the Diagram.selection Set.