Commit c4b8d61 1 parent b4fd78e commit c4b8d61 Copy full SHA for c4b8d61
File tree 1 file changed +8
-3
lines changed
electron/renderer/components/game
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -72,10 +72,15 @@ export const GameRoundTime: React.FC = (): ReactNode => {
72
72
}
73
73
} ) ;
74
74
75
+ // Clear the counters otherwise they continue to tick down in the UI.
76
+ // I also tried clearing the interval, but because the component is still
77
+ // mounted then even when reconnecting to the game or reloading the page
78
+ // then the interval wasn't restarting and the numbers were frozen.
79
+ // This was the simplest solution I landed on.
75
80
useSubscribe ( 'game:disconnect' , ( ) => {
76
- clearInterval ( intervalRef . current ) ;
77
- setCurrentRT ( 0 ) ;
78
- setCurrentCT ( 0 ) ;
81
+ serverTimeRef . current = 0 ;
82
+ roundTimeRef . current = 0 ;
83
+ castTimeRef . current = 0 ;
79
84
} ) ;
80
85
81
86
const roundTimeCmp = useMemo ( ( ) : ReactElement => {
You can’t perform that action at this time.
0 commit comments