dazzle
dazzle copied to clipboard
Duplicate widgets
The issue happened when drag a widget from same column index but different row. It is also existing in demo, http://raathigesh.com/dazzle/ The reproduce steps:
- drag 'reactor temp' to top 1st row 1st column
- drag the 'reactor temp' to 2nd row 1st column
we can add monitor.getItem().rowIndex===rowIndex in WidgetFrame line 63 to fix this temporarily. But it only can support change the order in a same column, do you want to support move a widget from different column or row and change the order at the same time.
I'm also experiencing this issue.
Is there any roadmap on when this will be addressed?
I relocated to Australia very recently and not been able to focus on the projects quite yet! I could take a look into this issue in another week or two! Feel free to send a PR if you could fix it!
I just encountered this issue, @SixLiu is correct - it happens because sorting tries to happen even though you are dragging between different rowIndex (but the same columIndex). I suspect it's the sortWidgets call that's resulting in the duplicates, but don't have the time to investigate.
Changing to this in the hover function in cardTarget resolves it (but means you have to drop a widget into a different row before you can sort it in that row):
if (monitor.getItem().columnIndex === columnIndex && monitor.getItem().rowIndex === rowIndex) {
const newLayout = sortWidget(layout, {
....