Bug description

When I drag a metric very quickly (i.e., I move the mouse in one swift motion) inside the Metrics control of Explore, the original order of all metrics that the cursor passes over becomes corrupted.
The problem does not occur when I move the metric slowly, one position at a time.

Screenshots/recordings

before the draging:

Image

After quickly draging the tz to the first postion:

Image

Superset version

master / latest-dev

Python version

3.10

Node version

18 or greater

Browser

Chrome

Additional context

No response

Checklist

  • [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Comment From: dosubot[bot]

This looks like a real bug with the drag-and-drop reordering in Explore controls. The frontend uses the react-sortable-hoc library (which is no longer maintained) to handle drag-and-drop, and the item order is updated using its arrayMove function when a drag ends. There’s no built-in throttling or debouncing, so rapid movements can cause state inconsistencies and scramble the order, especially during fast drags. I couldn’t find any existing reports or fixes for this issue in the repo or docs, and there aren’t any comments in the code about handling rapid drag events or known limitations with this approach. If you need to investigate or patch this, the relevant logic is in the DndColumnSelectControl component and its onSortEnd handler, where the array order is updated using arrayMove from react-sortable-hoc
(source).

A possible workaround would be to try slower, one-at-a-time drags for now, or to look into replacing or patching the drag-and-drop logic to better handle rapid movements.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

Comment From: rusackas

I wonder if AntD provides vanilla components for this to just get rid of react-sortable-hoc (@geido @msyavuz)

Comment From: msyavuz

I don't think antd provides something like this. They recommend popular dnd libraries for this as well.