Skip to content

Commit

Permalink
component should only update if a player exists (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackdupkevin authored Feb 24, 2023
1 parent 0c43c3a commit fea7828
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/jwplayer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ class JWPlayer extends React.Component {
}

shouldComponentUpdate(nextProps) {
if (this.didOnEventsChange(nextProps)) {
this.updateOnEventListener(nextProps);
return false;
if (this.player) {
if (this.didOnEventsChange(nextProps)) {
this.updateOnEventListener(nextProps);
return false;
}
return true;
}
return true;
}

componentWillUnmount() {
Expand Down

0 comments on commit fea7828

Please sign in to comment.