Skip to content

Single property schema where the property is an array does not work (broken since 1.0.0) #5242

@diarmidmackenzie

Description

@diarmidmackenzie

Description:

Working version using A-Frame 0.8.0 here:
https://glitch.com/edit/#!/single-property-schema-array?path=index.html%3A8%3A23

Found when updating superframe emplate examples to 1.4.1.

Linked Glitch is a very simple example which uses a single property schema, where the property is an array, and outputs the data to screen via the 'text' property.

This works OK at 0.8.0. From 1.0.0, including at 1.4.1, this no longer works.

This branch adds a Unit Test that exhibits the problem, but I haven't figured out a good fix for this yet.

Diagnosis of the problem so far:

The component does not get classified as isObjectBased (I don't know for sure whether that's correct or not) because this expression is not true:

isObject(parseProperty(undefined, this.schema))

here

Then, in updateCachedAttrValue, this.attrValue gets set up correctly, but the array entries it points to have been copied in by reference, not value, and so get changed to undefined on the call to clearObject

The relevant code is here

A puzzling earlier line of code is the use of value instanceof Object here, rather than using isObject.

For an array, isObject is false, but value instanceof Object is true, because an Array is an instance of an Object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions