butterfly icon indicating copy to clipboard operation
butterfly copied to clipboard

fix: `type` and `Class` are overridden in object spread

Open eranshmil opened this issue 3 years ago • 2 comments

When trying to use the components from the butterfly-vue and butterfly-react, the supplied type and Class properties are being overridden and don't work as intended.

For example:

export default {
  nodes: [
    {
      id: '1',
      label: '张三',
      left: 600,
      top: 50,
      iconType: 'icon-wo',
      Class: CustomNode,
      endpoints: [
        {
          id: 'right',
          orientation: [1, 0],
          pos: [0, 0.5],
        },
        {
          id: 'bottom',
          orientation: [0, 1],
          pos: [0.5, 0],
        },
        {
          id: 'left',
          orientation: [-1, 0],
          pos: [0, 0.5],
        },
      ],
    },
    ...
  ],
  ...
}

The node won't be the CustomNode, but the default Node.

eranshmil avatar Mar 22 '21 21:03 eranshmil

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Mar 22 '21 21:03 CLAassistant

I don't think is not a good solution to solve this problem. Cause I have rewrited BaseNode.click for the reason of emit node click event to React Element in render.

cctv1005s avatar Mar 25 '21 03:03 cctv1005s