We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac4f61a commit d4b0c80Copy full SHA for d4b0c80
src/components/AsideHeader/components/AllPagesPanel/utils/sortMenuItems.ts
@@ -5,7 +5,9 @@ import {buildExpandedFromFlatList} from './buildExpandedFromFlatList';
5
export function sortMenuItems(oldIndex: number, newIndex: number, items: MenuItemsWithGroups[]) {
6
const sortedItems = [...items];
7
8
- [sortedItems[oldIndex], sortedItems[newIndex]] = [sortedItems[newIndex], sortedItems[oldIndex]];
+ const [movedElement] = sortedItems.splice(oldIndex, 1);
9
+
10
+ sortedItems.splice(newIndex, 0, movedElement);
11
12
const expandedItems = buildExpandedFromFlatList(sortedItems);
13
const updatedItems = expandedItems.map((item, index) => ({
0 commit comments