Problem:
When dragging a widget out of the dashboard into a popup window, the widget was not being removed from the dashboard's items array because removeFromPreviousParent was set to false during the move. This led to:
- Duplicate References: Upon re-integration (closing the popup), the widget was inserted back into the dashboard, causing duplicate entries in the items array.
- Destruction Issues: In complex drag scenarios (out -> in -> out), the widget could be inadvertently destroyed when the drag proxy was cleaned up.
Solution:
- Dashboard Cleanup: Enhanced StrategyPanelController.onDragEnd() to explicitly remove the dragged item from the dashboard's items array if the drag operation concluded with a window detachment (isWindowDragging: true). This ensures the dashboard state is clean while the widget lives in the popup.
- Proxy Protection: Updated src/draggable/DragProxyContainer.mjs with a custom destroy() method that clears its items array before calling super.destroy(). This prevents the destruction of child widgets (the dragged item) when the drag proxy is destroyed at the end of a drag operation.
This combination ensures robust re-integration even after multiple drag interactions.
Problem: When dragging a widget out of the dashboard into a popup window, the widget was not being removed from the dashboard's items array because removeFromPreviousParent was set to false during the move. This led to:
Solution:
This combination ensures robust re-integration even after multiple drag interactions.