Uncaught TypeError: Cannot assign to read only property 'type' of object '#<Object>'


When I use diagram editor, I use our api result to make the parse data like below:

data = [
  id: 'a_1',
  x: 50,
  y: 50,
  type: 'plugImg',
  name: 'test',
  img: '/api/media/cable_type/image90.png/',
  width: 200,
  height: 107.29783037475345,
  id: 'a_2',
  x: 50,
  y: 167.29783037475346,
  type: 'plugImg',
  name: 'test',
  img: '/api/media/cable_type/image79.png/',
  width: 200,
  height: 71.03274559193954,

I use addShape to create
diagram?.diagram.addShape(‘plugImg’, {
template: (config) => (
<section style="background-color: #dfdfdf;"> <img src='${config.img}' style="width:180px; height:auto;"/> </section>

I’m sure that the addShape can use, cause I use const data to parse will be OK.
But when I use api data, it will make error, is there anything wrong?


If I use this, it will active


but maybe there is something wrong…??