Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug when checking schema properties for schemaChange #5426

Merged
merged 2 commits into from
Jan 8, 2024

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!

@dmarcos dmarcos merged commit 1420803 into aframevr:master Jan 8, 2024
1 check passed
@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