File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,12 +39,15 @@ class Note extends React.PureComponent {
3939 await this . stopPlayingNote ( ) ;
4040 }
4141 }
42- // shouldComponentUpdate(nextProps, nextState) {
43- // // TODO: split into consts
44- // // return true;
45- // const shouldUpdate = this.state.isLoading || (nextProps.name !== this.props.name) || (nextProps.instrumentName !== this.props.instrumentName) || (nextState.isPlaying !== this.state.isPlaying) || (nextProps.play !== this.props.play) || this.state.isPlaying || this.state.isPlaying !== nextState.isPlaying;
46- // return shouldUpdate;
47- // }
42+ shouldComponentUpdate ( nextProps , nextState ) {
43+ // TODO: split into consts
44+ // return true;
45+ const isLoading = this . state . isLoading || nextState . isLoading ;
46+ const isPlaying = this . state . isPlaying !== nextState . isPlaying ;
47+ const isPlayingControlled = this . props . play !== nextProps . play ;
48+ const shouldUpdate = isLoading || isPlaying || isPlayingControlled ; // this.state.isLoading || (nextProps.name !== this.props.name) || (nextProps.instrumentName !== this.props.instrumentName) || (nextState.isPlaying !== this.state.isPlaying) || (nextProps.play !== this.props.play) || this.state.isPlaying || this.state.isPlaying !== nextState.isPlaying;
49+ return shouldUpdate ;
50+ }
4851 componentWillUnmount ( ) {
4952 this . sound . release ( ) ;
5053 }
You can’t perform that action at this time.
0 commit comments