Binding error: cannot modify GraphObject.name on Picture

Hello,

Here is a part of the template who cause the issue

$(go.Picture,
        {margin: 1, width: 24, height: 24, alignment: go.Spot.TopLeft},
        new go.Binding('source', 'flowDirectionIcon'),
        new go.Binding('name', 'key'),
        {
          toolTip:
            $('ToolTip',
              $(go.TextBlock, {margin: 3},
                new go.Binding('text', 'flowDirectionIconTooltip')
              ))
        },
        {
          click: (e: any, thisObj: go.GraphObject) => {
            console.log(twinNode(thisObj.name))
            const twin = findNode(twinNode(thisObj.name), e.diagram.nodes);
            if(twin == null) return;
            focusOnNode(twin, e.diagram);
          }
        }
      )

I am binding the key to go.Picture.name

The GraphObject.name property is meant to allow calls to Panel.findObject to retrieve a particular element of a Panel such as a Node.

It does not make sense for any GraphObject’s name to change dynamically, because code would not know which name to use in a call to findObject on a Node or item Panel.

Think of the “name” property in a Node like the “id” property in HTML DOM and Panel.findObject like getElementById.

I agree but how am I supposed to give it a name dynamically (I don’t want to change his name) but as long as it is a part of a bigger template

What are you trying to accomplish?

I want to get the key in the click in order to find a specific node related to him

{
  click: (e, obj) => alert(obj.part.key)
}