Group member disappears after mousedrop

When I drop a member into a group, it is visible for a fraction of a second and then disappears (confirmed this by placing a debugger in the selectionMoved function). The member is however rendered correctly when the page is refreshed (i.e. the diagram is re-drawn). Any pointer would be helpful.

It would seem that the reason is that the layer is getting changed. I am not sure how at the moment but the issue is that I have set the zOrder and layerName of the node inside the “memberadded” function so that it appears on top of the group, but it would seem that the “layerName” is getting reset to empty.

Never mind. I found the problem. There was a piece of code that was clearing the layerName of the part being dragged.