bito-code-review[bot] commented on PR #41637:
URL: https://github.com/apache/superset/pull/41637#issuecomment-4930363043

   <!-- Bito Reply -->
   The flagged issue is correct. The migration to `@dnd-kit` requires using 
`arrayMove(items, fromIndex, toIndex)` to handle reordering, as it performs a 
full array move rather than a simple swap. Using the parameters in the order 
`(dragIndex, hoverIndex)` is correct for `arrayMove`, but the callback 
parameters were named `(hoverIndex, dragIndex)` in some components, leading to 
inverted reordering.
   
   To resolve this, ensure the callback parameters are consistently named 
`(dragIndex, hoverIndex)` and passed to `arrayMove` in that order. I have 
verified that this pattern is correctly applied in other components within this 
PR (e.g., `DndColumnMetricSelect.tsx`, `DndFilterSelect.tsx`, 
`DndMetricSelect.tsx`).
   
   Would you like me to fetch all remaining review comments to validate and 
implement fixes for the rest of the PR?
   
   
**superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnMetricSelect.tsx**
   ```
   const onShiftOptions = useCallback(
       (dragIndex: number, hoverIndex: number) => {
         // @dnd-kit fires the reorder once at drag-end with the final indices, 
so
         // this must be a full arrayMove, not an adjacent swap.
         const newValues = arrayMove(coercedValue, dragIndex, hoverIndex);
         onChange(multi ? newValues : newValues[0]);
       },
       [onChange, coercedValue, multi],
     );
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to