From b6fa5eca7e1394e6eba6b9a046f1ef533d886f8e Mon Sep 17 00:00:00 2001 From: David McFadzean Date: Sat, 21 Oct 2023 10:31:13 -0400 Subject: [PATCH] Collection's temp asset arrary is removed before saving --- xidb.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xidb.js b/xidb.js index 1399ce4..ec886da 100644 --- a/xidb.js +++ b/xidb.js @@ -1499,6 +1499,8 @@ const createCollection = (userId, name) => { }; const saveCollection = (collection) => { + assert.ok(collection.collection); + const agentData = getAgent(collection.asset.owner); const collectionId = collection.xid; @@ -1507,10 +1509,14 @@ const saveCollection = (collection) => { saveAgent(agentData); } + // assets are generated at runtime because metadata.asset.collection is the source of truth + collection.collection.assets = []; saveAsset(collection); }; const removeCollection = (collection) => { + assert.ok(collection.collection); + const agentData = getAgent(collection.asset.owner); const collectionId = collection.xid;