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 #723

Merged
merged 1 commit into from
Jul 1, 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
Fix TextureWidget componentDidUpdate to not crash React UI on aframe …
…1.6.0 (fix #722)
vincentfretin committed Jun 16, 2024

Verified

This commit was signed with the committer’s verified signature.
commit 69c5776c3af3a7372fbe32660945533ad60b1a82
16 changes: 5 additions & 11 deletions src/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);
}
}