From 3949ea344832078ce770425dde18822b345d51da Mon Sep 17 00:00:00 2001 From: ThaumRystra Date: Sat, 9 Nov 2024 15:44:06 +0200 Subject: [PATCH] Fixed creature templates added to tabletops not getting their properties set --- .../addCreaturesFromLibraryToTabletop.ts | 6 +++++- .../properties/forms/CreatureTemplateForm.vue | 18 +++++++++++------- app/imports/server/publications/tabletops.js | 4 ++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/imports/api/tabletop/methods/addCreaturesFromLibraryToTabletop.ts b/app/imports/api/tabletop/methods/addCreaturesFromLibraryToTabletop.ts index 5ec398f3..0ac8152a 100644 --- a/app/imports/api/tabletop/methods/addCreaturesFromLibraryToTabletop.ts +++ b/app/imports/api/tabletop/methods/addCreaturesFromLibraryToTabletop.ts @@ -88,14 +88,17 @@ const addCreaturesFromLibraryToTabletop = new ValidatedMethod({ }); function insertSubProperties(node, creatureId: string) { + console.log({ node, }) let nodes = LibraryNodes.find({ ...getFilter.descendants(node), removed: { $ne: true }, }).fetch(); + console.log('found nodes', nodes); + for (const node of nodes) { node.root = { - '_id': creatureId, + id: creatureId, collection: 'creatures', }; } @@ -113,6 +116,7 @@ function insertSubProperties(node, creatureId: string) { }); // Insert the creature properties + console.log('final nodes', nodes); // @ts-expect-error Batch insert not defined if (nodes.length) CreatureProperties.batchInsert(nodes); return node; diff --git a/app/imports/client/ui/properties/forms/CreatureTemplateForm.vue b/app/imports/client/ui/properties/forms/CreatureTemplateForm.vue index 30365f8c..fff10852 100644 --- a/app/imports/client/ui/properties/forms/CreatureTemplateForm.vue +++ b/app/imports/client/ui/properties/forms/CreatureTemplateForm.vue @@ -1,28 +1,28 @@