caplin / FlexLayout

Docking Layout Manager for React
MIT License
925 stars 174 forks source link

addTabWithDragAndDrop - duplicate id #48

Open tulodzieckim opened 5 years ago

tulodzieckim commented 5 years ago

I have a toggler to add/remove component from my app. When I use methods: addTabToActiveTabSet and addTabToTabSet everything works, but both addTabWithDragAndDrop and addTabWithDragAndDropIndirect gives me an error:

Uncaught Error: each node must have a unique id, duplicate id: InstrumentChoser

It seems thet after error component has been added to _idMap: instrumentchosererror but with above properties.

Aliaksei-Martsinkevich commented 4 years ago

This issue is reproduced only when tab has a predefined id. In this case model.addTab is called twice: first time when Layout.onDragDivMouseDown creates TabNode._fromJson, which automatically adds it to model and second time, when Layout.onDragEnd executes Actions.addNode with that node, it's already in _idMap

pgn-vole commented 4 years ago

I've been facing the same problem. Any chance it could be looked at? It prevents using custom ids with drag & drop.

nealus commented 4 years ago

added a fix for this