Disable Layout arrangement after canceling action?

Hello,
Is there a way to disable layout rearrangement after doCancel() is called?
here is my application with example diagram:
initial state:


I allow user to move nodes around so after few actions it can looklike this:

I validate drag and drop from the palette to diagram, have few rules what users can do, and cannot do. When a user does something that is not allowed I run diagram.currentTool.doCancel() so the action is canceled. This however does not return to the previous state, but rather to the initial one.
Why is it a problem for me?
I store model state in react state and it is updated and used on every change. After doCancel is called this state is not updated and it holds old positions of nodes and links (arrangement made by the user). When I move another node again graph looks like this:

Nodes stay in the same places, but links jump back to the previous arrangement.

I see two solutions here.
1 - I can update the state after doCancel call with current locations of every element. I didn’t found any property from the diagram I could use for getting the required information, for example diagram.model.modelData given me an empty object.
2 - If I could disable this rearrangement I would probably leave everything else as is and everything would work fine.

Is there any suggestion from you I could use for 2 solution? Or could you help me with first one?

The drop adds a node to the diagram, which invalidates the layout. Then you call doCancel, which restores the model to how it was before the drag-and-drop happened. But the layout is still invalidated, so the layout is still performed.

What you can do is explicitly validate the layout:

        $(go.Diagram, ...
          {
            layout: $(go.TreeLayout),
            mouseDrop: function(e) {
              if (... some reason to cancel the drop ...) {
                e.diagram.currentTool.doCancel();
                e.diagram.layout.isValidLayout = true;
              }
            },
            "undoManager.isEnabled": true
          });

Or, for anyone else reading this, if you are using “ExternalObjectsDropped” instead of Diagram.mouseDrop:

        $(go.Diagram, ,,,
          {
            layout: $(go.TreeLayout),
            "ExternalObjectsDropped": function(e) {
              if (... some reason to cancel the drop ...) {
                e.diagram.toolManager.draggingTool.transactionResult = null;
                e.diagram.layout.isValidLayout = true;
              }
            },
            "undoManager.isEnabled": true
          })

That helped, thank you!