Warnings seen while adding adornment to link to put the link label to the front

Hi Walter,

Is the warning seen expected? How to solve this?

Here’s my adornment code for link :

selectionAdornmentTemplate:
    		      $$(go.Adornment,
    				{
    					  layerName: 'AdornmentLayer'
    				},
    		        $$(go.Shape,
    		          { isPanelMain: true, stroke: "dodgerblue", strokeWidth: 4 })
              	)  

Here’s the warning I am seeing:

Change not within a transaction: !dEnumValue.Insert parts: AdornmentLayer  new: Adornment()ParallelLink#2160([object Object]) 0
go-debug.js?r=Extreme Management Center 8.5.0.DEV23:14 Change not within a transaction: !d data: Adornment()ParallelLink#2160([object Object])  new: [object Object]
go-debug.js?r=Extreme Management Center 8.5.0.DEV23:14 Change not within a transaction: !d category: Adornment(Selection)ParallelLink#2160([object Object])  old:   new: Selection

It’s probably because there is no Layer named “AdornmentLayer”, so it’s being added to the default layer, causing the ChangedEvent being recorded by the UndoManager.

Try changing your code from “AdornmentLayer” to “Adornment”. Better yet, just remove that assignment. That’s the default layer for Adornments.

I am making sure, I add a new layer with that name.
I have this :

var backlayer = goJsDiagram.findLayer("Background");
  		goJsDiagram.addLayerBefore($$(go.Layer, { name: "AdornmentLayer" }), backlayer);

Ah, OK. So the problem is that you haven’t set Layer.isTemporary to true on that new Layer.

Should I do that? Would it have adverse effect? I dont want that layer to be temporary. Just trying to understand

It’s not saying that the layer is temporary – it’s saying that objects in the layer are temporary.
https://gojs.net/latest/api/symbols/Layer.html#isTemporary