Skip to content

Conversation

@mrxz
Copy link
Contributor

@mrxz mrxz commented Jan 7, 2024

Description:
Components that have one or more properties marked as schemaChange will check if any of these properties change to trigger an updateSchema. While checking the properties in an update, it incorrectly assumes each property to also exist, which might not be the case.

Reproduction (https://glitch.com/edit/#!/beaded-basalt-church?path=index.html):

<script>
    AFRAME.registerComponent('bug', {
      init: function() {
        this.el.setAttribute('material', {
            invalidProperty: 'causes an error',
        })
      }
    })
</script>
(...)
<a-scene>
    <a-entity material bug></a-entity>
</a-scene>

Changes proposed:

  • Ensure a property is part of the schema before checking its schemaChange flag

@dmarcos
Copy link
Member

dmarcos commented Jan 7, 2024

Is it possible to cover the fix with a test?

@mrxz
Copy link
Contributor Author

mrxz commented Jan 8, 2024

Added a couple unit tests covering schemaChange/udpateSchema (there were non before) including one covering the fixed behaviour.

@dmarcos
Copy link
Member

dmarcos commented Jan 8, 2024

Thanks!

@vincentfretin
Copy link
Contributor

@mrxz There is a related error in the aframe-inspector demo page. I didn't have time to investigate but it's exactly on the same line you just changed.
aframevr/aframe-inspector#701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants