@@ -19,7 +19,7 @@ import {
1919import Frequencies from "Components/statusBar/Frequencies" ;
2020import { StyledExerciseContainer } from "Styles/layouts/ExerciseContainer.styles" ;
2121import { getHalGuiMethods } from "Helpers/editor" ;
22- import { subscribe , unsubscribe } from "Helpers/utils" ;
22+ import { clearTimeouts , subscribe , unsubscribe } from "Helpers/utils" ;
2323import { fileExplorer } from "Helpers/explorer" ;
2424import getTools from "Helpers/tools" ;
2525
@@ -66,9 +66,6 @@ const ExerciseContainer = ({
6666 setUniverses ( list ) ;
6767 } ;
6868
69- // RB manager setup
70- const connected = useRef < boolean > ( false ) ;
71-
7269 const resetUniverse = ( e : unknown ) => {
7370 const T = CustomEvent < { detail : unknown } > ;
7471 if ( e instanceof T ) {
@@ -93,13 +90,7 @@ const ExerciseContainer = ({
9390 }
9491 }
9592
96- if ( timeoutRef . current ) {
97- window . clearTimeout ( timeoutRef . current ) ;
98- }
99-
100- if ( connectTimeoutRef . current ) {
101- window . clearTimeout ( connectTimeoutRef . current ) ;
102- }
93+ clearTimeouts ( [ timeoutRef , connectTimeoutRef ] ) ;
10394 } ;
10495 } , [ ] ) ;
10596
@@ -113,7 +104,6 @@ const ExerciseContainer = ({
113104 await currManager . connect ( ) ;
114105 getUniverseList ( project ) ;
115106 console . log ( "Connected!" , currManager . getState ( ) ) ;
116- connected . current = true ;
117107 setManager ( currManager ) ;
118108 if ( callback ) {
119109 waitManagerState ( desiredState ? desiredState : "connected" , callback ) ;
0 commit comments