Skip to content

Commit

Permalink
Merge pull request #712 from 3DStreet/fix-texture-widget
Browse files Browse the repository at this point in the history
Fix TextureWidget componentDidUpdate to not crash React UI on aframe 1.6.0
  • Loading branch information
kfarr committed Jul 16, 2024
2 parents 0c0bdb0 + 1f04d52 commit e9144de
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/editor/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 e9144de

Please sign in to comment.