Duplicating properties now renews root sub-doc ids
This commit is contained in:
@@ -77,7 +77,8 @@ const duplicateProperty = new ValidatedMethod({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Give the docs new IDs without breaking internal references
|
// Give the docs new IDs without breaking internal references
|
||||||
renewDocIds({ docArray: nodes });
|
const allNodes = [property, ...nodes];
|
||||||
|
renewDocIds({ docArray: allNodes });
|
||||||
|
|
||||||
// Order the root node
|
// Order the root node
|
||||||
property.order += 0.5;
|
property.order += 0.5;
|
||||||
@@ -86,7 +87,7 @@ const duplicateProperty = new ValidatedMethod({
|
|||||||
property.dirty = true;
|
property.dirty = true;
|
||||||
|
|
||||||
// Insert the properties
|
// Insert the properties
|
||||||
CreatureProperties.batchInsert([property, ...nodes]);
|
CreatureProperties.batchInsert(allNodes);
|
||||||
|
|
||||||
// Tree structure changed by inserts, reorder the tree
|
// Tree structure changed by inserts, reorder the tree
|
||||||
reorderDocs({
|
reorderDocs({
|
||||||
|
|||||||
@@ -67,12 +67,13 @@ const duplicateLibraryNode = new ValidatedMethod({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Give the docs new IDs without breaking internal references
|
// Give the docs new IDs without breaking internal references
|
||||||
renewDocIds({ docArray: nodes });
|
const allNodes = [libraryNode, ...nodes];
|
||||||
|
renewDocIds({ docArray: allNodes });
|
||||||
|
|
||||||
// Order the root node
|
// Order the root node
|
||||||
libraryNode.order += 0.5;
|
libraryNode.order += 0.5;
|
||||||
|
|
||||||
LibraryNodes.batchInsert([libraryNode, ...nodes]);
|
LibraryNodes.batchInsert(allNodes);
|
||||||
|
|
||||||
// Tree structure changed by inserts, reorder the tree
|
// Tree structure changed by inserts, reorder the tree
|
||||||
reorderDocs({
|
reorderDocs({
|
||||||
|
|||||||
Reference in New Issue
Block a user