Change events not being recogned

So I created a file upload funtion in a bootstrap modal. The person uploads a spreadsheet of data. It is sent to the server from the browser and then returns a json to me to displayed in the diagram. The data is uploaded and shown on the diagram. However when I move a node the diagram doesn’t recognize it being moved. Any reasons why?

Here is the code for the upload (it works):
function isInArray(filesAccepted, filetype) {

    if ((filesAccepted.indexOf(filetype.toLowerCase())) > -1){
           $('.errorfile').css('opacity', 0);
           $.ajax({
            type: 'POST',
            url: '/incident_response/import_asset_file',
            data: form_data,
            contentType: false,
            cache: false,
            processData: false,
            async: true,
            success: function(data) {
                    console.log('Success!');
                    var data = JSON.parse(data),
                    initial_data = data['data_list'];
                    initial_data.class= "go.GraphLinksModel";
                    myDiagram.model = go.Model.fromJson(initial_data);
                    phx.modal.hide();
                    $.when(save()).then(save());
            }
          }); 
        
    } else {
         $('.errorfile').css('opacity', 1);
    }

}

If i don’t upload a file to display and just add a node the diagram it recognizes it, so I know my event listener is working at that time. Here is the code for the event listener:

myDiagram.model.addChangedListener(function(e) {

        if (e.change === go.ChangedEvent.Transaction) {
              
              if (e.propertyName === "CommittingTransaction" || e.modelChange === "SourceChanged"){
                  console.log("changed")
              }    
              if (e.isTransactionFinished && e.oldValue !== "Layout"){
                  console.log( e.oldValue)
                  console.log("start");
                  $.when().then(save());
              }
        } 
  })

Sorry if this is confusing.

In your success function you are replacing the Diagram.model, thereby discarding any changes you have made to it, including any Changed listeners.

Call Diagram.addModelChangedListener instead of Model.addChangedListener.

Thank you! Changing it to Diagram.addModelChangedListener worked. Now I am listening for changes specifically for the diagram not the model. Your right the i was replacing the entire model so the disregarding all previous changes. Thank you for replying and thank you for being able to understand!

To clarify, Diagram.addModelChangedListener still adds a Changed listener to a Model and that listener still gets ChangedEvents for models (i.e. ChangedEvent.model will be non-null).

It just manages the listeners for you if you might replace the Diagram.model.