Skip to content

Commit

Permalink
Add changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
clauderic authored and Clauderic Demers committed Oct 25, 2021
1 parent 94cd71d commit d86529c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/better-swappable-handling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@dnd-kit/sortable": minor
---

Improvements to better support swappable strategies:

- Now exporting an `arraySwap` helper to be used instead of `arrayMove` `onDragEnd`.
- Added the `getNewIndex` prop on `useSortable`. By default, `useSortable` assumes that items will be moved to their new index using `arrayMove()`, but this isn't always the case, especially when using strategies like `rectSwappingStrategy`. For those scenarios, consumers can now define custom logic that should be used to get the new index for an item on drop, for example, by computing the new order of items using `arraySwap`.

0 comments on commit d86529c

Please sign in to comment.