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 TextureWidget componentDidUpdate to not crash React UI on aframe 1.6.0 #712

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions src/editor/components/widgets/TextureWidget.js
Original file line number Diff line number Diff line change
@@ -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);
}
}