From f2f45dce36066f01a956bef7e9aedfef6d1c2e21 Mon Sep 17 00:00:00 2001 From: JackdupKevin Date: Sun, 28 Aug 2022 12:52:58 +0300 Subject: [PATCH] component should only update if a player exists --- src/jwplayer.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/jwplayer.jsx b/src/jwplayer.jsx index 1df0cd0..84594fd 100644 --- a/src/jwplayer.jsx +++ b/src/jwplayer.jsx @@ -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() {