From d86529cde6daa650e9c9edce7f26fb691d71d723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claud=C3=A9ric=20Demers?= Date: Mon, 25 Oct 2021 11:20:28 -0400 Subject: [PATCH] Add changeset --- .changeset/better-swappable-handling.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .changeset/better-swappable-handling.md diff --git a/.changeset/better-swappable-handling.md b/.changeset/better-swappable-handling.md new file mode 100644 index 00000000..c50f6417 --- /dev/null +++ b/.changeset/better-swappable-handling.md @@ -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`.