Asset property type needs to parse attrValue when updating#4579
Open
paolis92 wants to merge 1 commit intoaframevr:masterfrom
Open
Asset property type needs to parse attrValue when updating#4579paolis92 wants to merge 1 commit intoaframevr:masterfrom
paolis92 wants to merge 1 commit intoaframevr:masterfrom
Conversation
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)
dmarcos
reviewed
May 7, 2020
| 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') { |
Member
There was a problem hiding this comment.
Adding an exception for a specific parser is brittle. We would need to find a more robust way.
Author
There was a problem hiding this comment.
Maybe we can always call parse function like it happens for components that have schema with more than one property (am I wrong here?) a few lines below the highlighted ones
parseProperties(attrValue, this.schema, true, this.name);
Contributor
|
@paolis92 That PR is really old, and I see your issue is closed, so I guess you can close that PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
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)This change should fix #4341
Changes proposed: