This PR fixes the drag-and-drop in the LayerPanel by changing the type of drag target in the Draggable component from Layer model to layer id, so that the Draggable won't hold a stale layer model.
More details about the fix:
In the recent layer panel PR, LayerFace stores some Layer model attributes (selected/expanded/visible) in its state. When it receive a new layer prop, it will skip rendering if the change is the same as its state. As a result, the Draggable instance will hold the old version because the component is not re-rendered. This makes it fail when Draggable component needs to check whether it is the drag target when a drag event starts, which will always return false. The solution is to switch to layer id, which is a number and will never stale.
This PR fixes the drag-and-drop in the LayerPanel by changing the type of drag target in the
Draggable
component fromLayer
model to layer id, so that theDraggable
won't hold a stale layer model.More details about the fix:
In the recent layer panel PR,
LayerFace
stores someLayer
model attributes (selected/expanded/visible
) in its state. When it receive a new layer prop, it will skip rendering if the change is the same as its state. As a result, theDraggable
instance will hold the old version because the component is not re-rendered. This makes it fail whenDraggable
component needs to check whether it is the drag target when a drag event starts, which will always return false. The solution is to switch to layer id, which is a number and will never stale.