From c1a591e94542301e0d0e7645072539418f2ea558 Mon Sep 17 00:00:00 2001 From: Noah Over Date: Mon, 21 Feb 2022 12:09:09 -0500 Subject: [PATCH] [#180] Fix performance issues due to types --- app/javascript/src/components/Player.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/javascript/src/components/Player.tsx b/app/javascript/src/components/Player.tsx index af91626..126f727 100644 --- a/app/javascript/src/components/Player.tsx +++ b/app/javascript/src/components/Player.tsx @@ -104,7 +104,7 @@ class Player extends React.Component { showItemsStats: false } - timeout: number = 0 + timeout: any = null constructor(props: PlayerProps) { super(props) @@ -405,7 +405,7 @@ class Player extends React.Component { let showItem = this.showIfItem(port) let showStat = this.showIfStat(port) let isTimer = this.isTimer(port) - if (isTimer && this.timeout == 0) { + if (isTimer && this.timeout == null) { this.timeout = this.startTimer(port) } return !isTimer && showItem && showStat ? ( @@ -455,7 +455,7 @@ class Player extends React.Component { return isTimer } - private startTimer(port: DefaultPortModel): number { + private startTimer(port: DefaultPortModel): ReturnType { const timeoutSeconds: number = get(this.props.portMeta as any, `${port.id}.timeoutSeconds`) const that = this return setTimeout(function() {that.updateScene(port)}, timeoutSeconds * 1000) @@ -587,7 +587,7 @@ class Player extends React.Component { private stopTimer() { if (this.timeout) { clearTimeout(this.timeout) - this.timeout = 0 + this.timeout = null } }