Spurious Modified Diagram Event?

After loading the model from JSON, we potentially upgrade any legacy information in the nodes before assigning the model to the diagram. All this works fine. The issue is that I want to visibly indicate to the user that the diagram has effectively been modified by the upgrade step.

How can I do this?

I’ve tried setting myDiagram.isModified to true at various places (even in the InitialLayoutCompleted handler), but by the time the “Modified” event handler runs and examines myDiagram.isModified, it’s set to false.

What needs to be done to mark the diagram as modified, or at least have the “Modified” event learn the truth in this case?

Here is my model loading step:

        let model = this.loadFromFile(this.props.editor.uri); 
        //  i.e. model = go.Model.fromJson(data);
        this.versionUpModified = versionUpModel(model);
        myDiagram.model = model;

Thank you.

Of course from the point of view of the diagram, whatever model you give it assumes that it is unmodified. The diagram always makes sure it is “unmodified” after loading a model. That’s true even if you make modifications in an “InitialLayoutCompleted” DiagramEvent listener. It also clears out the UndoManager, unconditionally. Both meet the expectations of nearly all of our customers.

Of course from your point of view, the model really is semantically different. Perhaps you can make a real change to the diagram, such as updating the version number, in a function that is run after a setTimeout.