@@ -68,14 +68,13 @@ export const MainPage = ({ handleEditRecording, initialContent }: MainPageProps)
6868 const readyForRunHandler = useCallback ( ( browserId : string , runId : string ) => {
6969 interpretStoredRecording ( runId ) . then ( async ( interpretation : boolean ) => {
7070 if ( ! aborted ) {
71- // if (interpretation) {
72- // notify('success', t('main_page.notifications.interpretation_success', { name: runningRecordingName }));
73- // } else {
74- // notify('success', t('main_page.notifications.interpretation_failed', { name: runningRecordingName }));
75- // // destroy the created browser
76- // await stopRecording(browserId);
77- // }
78- if ( ! interpretation ) await stopRecording ( browserId ) ;
71+ if ( interpretation ) {
72+ notify ( 'success' , t ( 'main_page.notifications.interpretation_success' , { name : runningRecordingName } ) ) ;
73+ } else {
74+ notify ( 'success' , t ( 'main_page.notifications.interpretation_failed' , { name : runningRecordingName } ) ) ;
75+ // destroy the created browser
76+ await stopRecording ( browserId ) ;
77+ }
7978 }
8079 setRunningRecordingName ( '' ) ;
8180 setCurrentInterpretationLog ( '' ) ;
@@ -90,12 +89,6 @@ export const MainPage = ({ handleEditRecording, initialContent }: MainPageProps)
9089
9190 const handleRunRecording = useCallback ( ( settings : RunSettings ) => {
9291 createRunForStoredRecording ( runningRecordingId , settings ) . then ( ( { browserId, runId } : CreateRunResponse ) => {
93- localStorage . setItem ( 'runInfo' , JSON . stringify ( {
94- browserId,
95- runId,
96- recordingName : runningRecordingName
97- } ) ) ;
98-
9992 setIds ( { browserId, runId } ) ;
10093 const socket =
10194 io ( `${ apiUrl } /${ browserId } ` , {
@@ -105,18 +98,6 @@ export const MainPage = ({ handleEditRecording, initialContent }: MainPageProps)
10598 setSockets ( sockets => [ ...sockets , socket ] ) ;
10699 socket . on ( 'ready-for-run' , ( ) => readyForRunHandler ( browserId , runId ) ) ;
107100 socket . on ( 'debugMessage' , debugMessageHandler ) ;
108-
109- socket . on ( 'run-completed' , ( status ) => {
110- if ( status === 'success' ) {
111- notify ( 'success' , t ( 'main_page.notifications.interpretation_success' , { name : runningRecordingName } ) ) ;
112- } else {
113- notify ( 'error' , t ( 'main_page.notifications.interpretation_failed' , { name : runningRecordingName } ) ) ;
114- }
115- setRunningRecordingName ( '' ) ;
116- setCurrentInterpretationLog ( '' ) ;
117- setRerenderRuns ( true ) ;
118- } ) ;
119-
120101 setContent ( 'runs' ) ;
121102 if ( browserId ) {
122103 notify ( 'info' , t ( 'main_page.notifications.run_started' , { name : runningRecordingName } ) ) ;
@@ -127,7 +108,6 @@ export const MainPage = ({ handleEditRecording, initialContent }: MainPageProps)
127108 return ( socket : Socket , browserId : string , runId : string ) => {
128109 socket . off ( 'ready-for-run' , ( ) => readyForRunHandler ( browserId , runId ) ) ;
129110 socket . off ( 'debugMessage' , debugMessageHandler ) ;
130- socket . off ( 'run-completed' ) ;
131111 }
132112 } , [ runningRecordingName , sockets , ids , readyForRunHandler , debugMessageHandler ] )
133113
@@ -142,49 +122,6 @@ export const MainPage = ({ handleEditRecording, initialContent }: MainPageProps)
142122 } ) ;
143123 }
144124
145- useEffect ( ( ) => {
146- const storedRunInfo = localStorage . getItem ( 'runInfo' ) ;
147- console . log ( 'storedRunInfo' , storedRunInfo ) ;
148-
149- if ( storedRunInfo ) {
150- // Parse the stored info
151- const { browserId, runId, recordingName } = JSON . parse ( storedRunInfo ) ;
152-
153- // Reconnect to the specific browser's namespace
154- setIds ( { browserId, runId } ) ;
155- const socket = io ( `${ apiUrl } /${ browserId } ` , {
156- transports : [ "websocket" ] ,
157- rejectUnauthorized : false
158- } ) ;
159-
160- // Update component state with stored info
161- setRunningRecordingName ( recordingName ) ;
162- setSockets ( sockets => [ ...sockets , socket ] ) ;
163-
164- // Set up event listeners
165- socket . on ( 'ready-for-run' , ( ) => readyForRunHandler ( browserId , runId ) ) ;
166- socket . on ( 'debugMessage' , debugMessageHandler ) ;
167- socket . on ( 'run-completed' , ( status ) => {
168- if ( status === 'success' ) {
169- notify ( 'success' , t ( 'main_page.notifications.interpretation_success' , { name : recordingName } ) ) ;
170- } else {
171- notify ( 'error' , t ( 'main_page.notifications.interpretation_failed' , { name : recordingName } ) ) ;
172- }
173- setRunningRecordingName ( '' ) ;
174- setCurrentInterpretationLog ( '' ) ;
175- setRerenderRuns ( true ) ;
176- localStorage . removeItem ( 'runInfo' ) ; // Clean up stored info
177- } ) ;
178-
179- // Cleanup function
180- return ( ) => {
181- socket . off ( 'ready-for-run' , ( ) => readyForRunHandler ( browserId , runId ) ) ;
182- socket . off ( 'debugMessage' , debugMessageHandler ) ;
183- socket . off ( 'run-completed' ) ;
184- } ;
185- }
186- } , [ ] ) ;
187-
188125 const DisplayContent = ( ) => {
189126 switch ( content ) {
190127 case 'robots' :
0 commit comments