From 009b731b7ec8851e84834df0fe652236475e3f0c Mon Sep 17 00:00:00 2001 From: Megastruktur Date: Thu, 17 Sep 2020 10:40:26 +0300 Subject: [PATCH] GH-76 - Closes #76 - Fixes the "Add multiple items" bug When multiple items were added, the foreach mechanism caused the actor to update multiple times and rewrite previously added items. That's where some items were not actually added to an Actor (the UI was working fine but not the backend part). So it seemed that items are added (you can see them on the UI) but actuallythey were not. Now everything should work fine. --- module/blades-sheet.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/module/blades-sheet.js b/module/blades-sheet.js index 63a37a1..cf34aa6 100644 --- a/module/blades-sheet.js +++ b/module/blades-sheet.js @@ -88,9 +88,7 @@ export class BladesSheet extends ActorSheet { items_to_add.push(items.find(e => e._id === $(this).val())); }); - items_to_add.forEach(e => { - this.actor.createEmbeddedEntity("OwnedItem", duplicate(e)); - }); + this.actor.createEmbeddedEntity("OwnedItem", items_to_add); } /* -------------------------------------------- */