Cannot maintain position after dragging

Accurately say, dragging itself is normal but if I click the background node will return where it was.
I ruled out adding a click function to node and some other changes to the template, and then couldn’t think of anything else to do to cause the problem
Please help

Check for any warnings or errors in the console window. It helps if you use the go-debug.js or go-module-debug.js files instead of go.js, because the latter file doesn’t make as many checks during run-time.

Make sure all imports of the GoJS library only load the library once.

Sorry to ask further, how to switch to go-debug.js?

That depends on how your project is organized. If you are uniformly using npm, maybe it would be easiest to temporarily rename the files in the gojs/release/ directory.

Is the model being reloaded when the user clicks in the background? I.e., is the Diagram.model being replaced, or are the Model.nodeDataArray and GraphLinksModel.linkDataArray being replaced or modified?

Is the diagram being laid-out again when the user clicks in the background? I.e., is the Diagram.layout being performed again, quite unnecessarily?

Thank you very much for your patient answer, although I didn’t end up relying on it to find the problem.
I now find that the cause of the problem is that I set the selectAdornment, but apparently I don’t quite understand the reason for it, I set the selectAdornment as follows

const inputAdornmentTemplate = 
    $(go.Adornment, "Spot",
      $(go.Panel, "Auto",
        $(go.Shape, { fill: null, stroke: Color.selectionStroke, strokeWidth: 3 }),
const inputTemplates = 
    $(go.Node, "Auto",
      { name: 'nodeBody',minSize: new go.Size(160, 30), height: 30},
      $(go.Shape, 'Rectangle',
        { name: 'nodeBodyShape', fill:Color.nodeBackground },
        { margin: 5,height: 30, overflow: go.TextBlock.OverflowEllipsis,textAlign:"center" ,verticalAlignment:go.Spot.Center ,
         wrap: go.TextBlock.None, stroke: Color.labelText, alignment: go.Spot.Center, font: Font._textFont },  
      ).bind("text", "name"),

Is it because I set it to another layer? Or is it some other reason for selectAdornment?
Looking forward to your answer

Ah, yes, that could be causing a layout to happen whenever such an Adornment is added or removed from the diagram.

That is because by default whenever any Part (i.e. any Node or Link) is added or removed, the responsible Layout is invalidated, causing it to be performed again at the end of the transaction. For top-level Parts, that means the Diagram.layout, which you have set.

However, to avoid this problem, the “Adornment” Layer, has Layer.isTemporary set to true.

That causes adding or removing Adornments to or from that Layer not to invalidate the Layout.

So if you have created a Layer that gets Adornments, set its Layer.isTemporary property to true.