Compute difference problem

i m working on a diagram in angular 6 and the computejsondifference is giving me an error


the problem is that initially the diagram is empty and there are no links so in order to compute json difference what do i need to do?
the model is graph link model

No, that is not what the error states. If you want to call Model.computeJsonDifference, you need to make sure that the link data in your model have unique identifiers by setting GraphLinksModel.linkKeyProperty to some reasonable property name.

where exactly do i do that in the initialization of both models?
=>the main diagram
this.diagram.model = new go.GraphLinksModel([],[]);
=>the second model is
var savedModel = go.Model.fromJson({
“class”: “go.GraphLinksModel”,
“nodeDataArray”: this.tree_data_analyse,
“linkDataArray”:this.tree_data_links
});

Normally you would want to set the property before you assign the GraphLinksModel.linkDataArray. But I suppose if you’re just setting it to an empty Array in the case of your main diagram’s model, it doesn’t matter.

Then when you call Model.toJson, the resulting text will have that property set, as you can see in the sample State Chart With Incremental Saves, where it’s set to “id”.