Optimised when certain recompute functions are called to prevent unccessary work

This commit is contained in:
Stefan Zermatten
2021-02-04 13:59:08 +02:00
parent 326d1bd165
commit 6d1e3f078c
6 changed files with 24 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ import CreatureProperties from '/imports/api/creature/creatureProperties/Creatur
import getRootCreatureAncestor from '/imports/api/creature/creatureProperties/getRootCreatureAncestor.js';
import { assertEditPermission } from '/imports/api/sharing/sharingPermissions.js';
import { reorderDocs } from '/imports/api/parenting/order.js';
import recomputeInactiveProperties from '/imports/api/creature/denormalise/recomputeInactiveProperties.js';
import { recomputeCreatureByDoc } from '/imports/api/creature/computation/methods/recomputeCreature.js';
const insertProperty = new ValidatedMethod({
@@ -32,6 +33,8 @@ export function insertPropertyWork({property, creature}){
collection: CreatureProperties,
ancestorId: creature._id,
});
// Inserting the active status of the property needs to be denormalised
recomputeInactiveProperties(creature._id);
// Inserting a creature property invalidates dependencies: full recompute
recomputeCreatureByDoc(creature);
return _id;