File tree Expand file tree Collapse file tree 1 file changed +5
-18
lines changed
Expand file tree Collapse file tree 1 file changed +5
-18
lines changed Original file line number Diff line number Diff line change @@ -47,34 +47,21 @@ const Room = (): JSX.Element => {
4747
4848 useEffect ( ( ) => {
4949
50- // let _countdownTimerRef: NodeJS.Timeout | undefined = undefined;
51- let _countdownTimerRef : NodeJS . Timeout | null = null ;
52-
53- if ( isStarted && ! _countdownTimerRef ) {
50+ if ( isStarted ) {
5451
55- _countdownTimerRef = setInterval ( ( ) => {
52+ const _countdownTimerRef = setInterval ( ( ) => {
5653 let leftUnix = moment ( `1000-01-01 ${ left } ` ) . unix ( ) ;
57- const endUnix = moment ( '1000-01-01 00:00:00' ) . unix ( ) ;
5854
5955 leftUnix -- ;
6056
6157 const leftString = moment . unix ( leftUnix ) . format ( 'HH:mm:ss' ) ;
6258
6359 dispatch ( countdownTimerSlices . setCountdownTimer ( { left : leftString } ) ) ;
6460
65- if ( leftUnix === endUnix ) {
66- dispatch ( countdownTimerActions . stopCountdownTimer ( ) ) ;
67- }
68-
6961 } , 1000 ) ;
70- } else if ( _countdownTimerRef ) clearInterval ( _countdownTimerRef ) ;
71-
72- return ( ) : void => {
73- if ( _countdownTimerRef ) {
74- clearInterval ( _countdownTimerRef ) ;
75- _countdownTimerRef = null ;
76- }
77- } ;
62+
63+ return ( ) => { clearInterval ( _countdownTimerRef ) ; } ;
64+ }
7865
7966 } , [ isStarted , left , dispatch ] ) ;
8067
You can’t perform that action at this time.
0 commit comments