Update itemArray Problem

step 1:
once select the node and add two items to the array, second insertemitem overridding the first one also
step2:
select the node add the item in itemarray and unselect the node( click on background of diagram to unselect the node) and select it insert item into array working perfectly.

this.selectedNode.diagram.model.commit((m) => {
          if(appComp.editAttributeId == '0' || appComp.editAttributeId != '' && appComp.editAttributeId != 
               Preformatted text undefined) {
               let item = m.findNodeDataForKey(key).items.find(i => i.id == appComp.editAttributeId);
               m.set(item, 'name', newNodeData[0].name);
               m.set(item, 'type', newNodeData[0].type);
              m.set(item, 'primeryKey', newNodeData[0].primeryKey);
          } else {
              newNodeData[0].id = appComp.selectedNode.data.items.length;
                m.insertArrayItem(appComp.selectedNode.data.items, 
                appComp.selectedNode.data.items.length,newNodeData[0]);
           }
         }, "clicked"); ```

i inserted 'hello2' it overrides Array[0] also

0:
color: “#52ce60
figure: “Circle”
id: 1
iskey: false
name: “hello2”
primeryKey: false
type: “string”
__gohashid: 1574
proto: Object
1: {iskey: false, color: “#52ce60”, figure: “Circle”, name: “hello2”, type: “string”, …} ```

Could you please format your code as I suggested last time? Make sure everything is indented properly.

What is your problem? You have given some hard-to-read code, but you don’t say anything about the environment, what is happening, and what you want to happen instead.

issue solved. mistake using the same reference while pushing data into array :)