diff --git a/CHANGELOG.md b/CHANGELOG.md index 9109335321..d7c42d384b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Fixes * Adds an option to center the context menu arrow on the button icon. Sets this new option on some context menus in the admin UI. +* Fixes the update function of `AposSlatLists` so that elements are properly reordered on drag ## 4.6.1 (2024-08-26) diff --git a/modules/@apostrophecms/ui/ui/apos/components/AposSlatList.vue b/modules/@apostrophecms/ui/ui/apos/components/AposSlatList.vue index a003ecff57..cbb01cb7e7 100644 --- a/modules/@apostrophecms/ui/ui/apos/components/AposSlatList.vue +++ b/modules/@apostrophecms/ui/ui/apos/components/AposSlatList.vue @@ -131,13 +131,7 @@ export default { update({ oldIndex, newIndex }) { - if (oldIndex !== newIndex) { - this.next = this.next.map((elem, index) => { - return index === oldIndex - ? this.next[newIndex] - : (index === newIndex && this.next[oldIndex]) || elem; - }); - } + this.next.splice(newIndex, 0, this.next.splice(oldIndex, 1)[0]); }, engage(id) { this.engaged = id;