From 4bf744140b465f0570652228a4bb5d6250784adb Mon Sep 17 00:00:00 2001 From: Marco Paoliello Date: Thu, 7 May 2020 13:11:52 +0200 Subject: [PATCH] Asset property type needs to parse attrValue when updating Only in components with single-property schema asset is not parsed when updating (for example gltf-model) So #asset-id will not be converted in url necessary for this.data. Maybe instead of doing this in propertyTypes we should add the possibility to force a parse, like: function registerPropertyType (type, defaultValue, parse, stringify, parseRequired) so it becomes registerPropertyType('model', '', assetParse, undefined, true); and then in the code commited above instead of checking the parse function name, we check if (this.schema.parseRequired) --- src/core/component.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/component.js b/src/core/component.js index a64db49688f..85bf3155834 100644 --- a/src/core/component.js +++ b/src/core/component.js @@ -356,6 +356,11 @@ Component.prototype = { if (this.isObjectBased) { parseProperty(attrValue, this.schema); } + // Assets need parsing otherwise #asset-id will not be converted in url for this.data (ex gltf-model) + if (this.schema.parse.name === 'assetParse') { + this.data = parseProperty(attrValue, this.schema); + return; + } // Single-property (already parsed). this.data = attrValue; return;