Duplicating properties now renews root sub-doc ids

This commit is contained in:
Thaum Rystra
2023-09-18 14:12:30 +02:00
parent 673f187373
commit c274153c79
2 changed files with 6 additions and 4 deletions

View File

@@ -67,12 +67,13 @@ const duplicateLibraryNode = new ValidatedMethod({
});
// Give the docs new IDs without breaking internal references
renewDocIds({ docArray: nodes });
const allNodes = [libraryNode, ...nodes];
renewDocIds({ docArray: allNodes });
// Order the root node
libraryNode.order += 0.5;
LibraryNodes.batchInsert([libraryNode, ...nodes]);
LibraryNodes.batchInsert(allNodes);
// Tree structure changed by inserts, reorder the tree
reorderDocs({