Merge pull request #430 from lared/bugfix/misordered-requests

fix(#428): moving requests into directories or into root of collection broke ordering
This commit is contained in:
Anoop M D 2023-10-06 22:58:08 +05:30 committed by GitHub
commit 24fcb8caf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -138,7 +138,7 @@ export const moveCollectionItem = (collection, draggedItem, targetItem) => {
}
if (targetItem.type === 'folder') {
targetItem.items = targetItem.items || [];
targetItem.items = sortBy(targetItem.items || [], (item) => item.seq);
targetItem.items.push(draggedItem);
draggedItem.pathname = path.join(targetItem.pathname, draggedItem.filename);
} else {
@ -166,7 +166,9 @@ export const moveCollectionItemToRootOfCollection = (collection, draggedItem) =>
return;
}
draggedItemParent.items = sortBy(draggedItemParent.items, (item) => item.seq);
draggedItemParent.items = filter(draggedItemParent.items, (i) => i.uid !== draggedItem.uid);
collection.items = sortBy(collection.items, (item) => item.seq);
collection.items.push(draggedItem);
if (draggedItem.type == 'folder') {
draggedItem.pathname = path.join(collection.pathname, draggedItem.name);