Skip to content

Commit

Permalink
Fix TextureWidget componentDidUpdate to not crash React UI on aframe …
Browse files Browse the repository at this point in the history
…1.6.0 (fix #722)
  • Loading branch information
vincentfretin committed Jun 16, 2024
1 parent 0b8b8d5 commit 69c5776
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/components/widgets/TextureWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,11 @@ export default class TextureWidget extends React.Component {
this.setValue(this.props.value || '');
}

componentDidUpdate() {
var component = this.props.entity.components[this.props.componentname];
if (!component) {
return;
}
// component.attrValue may be undefined if component is from a mixin
var newValue = component.attrValue && component.attrValue[this.props.name];

// This will be triggered typically when the element is changed directly with element.setAttribute
if (newValue && newValue !== this.state.value) {
this.setValue(newValue);
componentDidUpdate(prevProps) {
// This will be triggered typically when the element is changed directly with
// element.setAttribute.
if (!Object.is(this.props.value, prevProps.value)) {
this.setValue(this.props.value);
}
}

Expand Down

0 comments on commit 69c5776

Please sign in to comment.