rete icon indicating copy to clipboard operation
rete copied to clipboard

addControl: Item has already been added to some node

Open fogine opened this issue 5 years ago • 2 comments

I believe there is a bug in code here, causing exception when calling node.addControl https://github.com/retejs/rete/blob/76605fda249796667a05d9a687b3c852f70b54a6/src/node.ts#L28-L29

as when not using typescript, Control instance has parent property qual to undefined.

fogine avatar Feb 16 '20 20:02 fogine

https://github.com/retejs/rete/blob/76605fda249796667a05d9a687b3c852f70b54a6/src/control.ts#L8

It's not a bug. Initially Control has parent = null. It seems that this control has already been added to some node, so you cannot add it again

Ni55aN avatar Feb 29 '20 10:02 Ni55aN

There is no error. I got the same exception and my mistake was extending the class using

class CustomControl extends Rete.Component

instead of

class CustomControl extends Rete.Control

That's probably why you don't have the parent property defined.

CosasDePuma avatar Jun 10 '21 05:06 CosasDePuma

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

rete-js[bot] avatar Jul 13 '23 10:07 rete-js[bot]