Skip to content

Commit

Permalink
Fix regression opening textures modal introduced with the React upgra…
Browse files Browse the repository at this point in the history
…de in #647
  • Loading branch information
vincentfretin committed Dec 24, 2022
1 parent 3b3ac22 commit 756c072
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/modals/ModalTextures.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ export default class ModalTextures extends React.Component {
this.generateFromAssets();
}

componentDidUpdate() {
componentDidUpdate(prevProps) {
if (this.state.isOpen && !AFRAME.INSPECTOR.assetsLoader.hasLoaded) {
AFRAME.INSPECTOR.assetsLoader.load();
}
if (this.state.isOpen && this.state.isOpen !== prevProps.isOpen) {
this.generateFromAssets();
}
}

static getDerivedStateFromProps(props, state) {
if (state.isOpen !== props.isOpen) {
if (props.isOpen) {
this.generateFromAssets();
}
return { isOpen: props.isOpen };
}
return null;
Expand Down

0 comments on commit 756c072

Please sign in to comment.