@@ -84,14 +84,11 @@ export const useLichessStreamController = (): LichessStreamController => {
8484 } )
8585 } , [ clearReconnectTimeout ] )
8686
87- const handleGameStart = useCallback (
87+ const handleStreamedGameInfo = useCallback (
8888 ( gameData : StreamedGame ) => {
8989 setGame ( ( prev ) => {
90- console . log ( 'CHECKING FOR GAME END' , prev ?. id , gameData . id )
9190 // if the game is already loaded, this is a game termination message
9291 if ( prev ?. id === gameData . id ) {
93- console . log ( 'GAME ENDED' )
94-
9592 setStreamState ( ( prev ) => ( {
9693 ...prev ,
9794 gameEnded : true ,
@@ -123,8 +120,6 @@ export const useLichessStreamController = (): LichessStreamController => {
123120
124121 const handleMove = useCallback (
125122 ( moveData : StreamedMove ) => {
126- console . log ( 'HANDLE MOVE:' , moveData )
127-
128123 streamMoves . current . push ( moveData )
129124
130125 if ( moveData . wc !== undefined && moveData . bc !== undefined ) {
@@ -154,12 +149,6 @@ export const useLichessStreamController = (): LichessStreamController => {
154149 try {
155150 const newGame = parseLichessStreamMove ( moveData , prev )
156151
157- if ( ! newGame . loaded ) {
158- if ( newGame . loadedFen === moveData . fen ) {
159- console . log ( 'LOADED GAME' )
160- }
161- }
162-
163152 return {
164153 ...newGame ,
165154 loaded : newGame . loaded
@@ -176,8 +165,6 @@ export const useLichessStreamController = (): LichessStreamController => {
176165 )
177166
178167 const handleStreamComplete = useCallback ( ( ) => {
179- console . log ( 'Stream completed' )
180-
181168 setStreamState ( ( prev ) => ( {
182169 ...prev ,
183170 isConnected : false ,
@@ -207,16 +194,14 @@ export const useLichessStreamController = (): LichessStreamController => {
207194
208195 try {
209196 // Start streaming directly - the stream API will handle invalid game IDs
210- // Note: isConnected will be set when we receive the first data (in handleGameStart or handleMove)
197+ // Note: isConnected will be set when we receive the first data (in handleStreamedGameInfo or handleMove)
211198 await streamLichessGame (
212199 gameId ,
213- handleGameStart ,
200+ handleStreamedGameInfo ,
214201 handleMove ,
215202 handleStreamComplete ,
216203 abortController . current . signal ,
217204 )
218-
219- console . log ( 'Stream completed' )
220205 } catch ( error ) {
221206 console . error ( 'Stream error:' , error )
222207
@@ -235,7 +220,7 @@ export const useLichessStreamController = (): LichessStreamController => {
235220 abortController . current = null
236221 }
237222 } ,
238- [ handleGameStart , handleMove , handleStreamComplete ] ,
223+ [ handleStreamedGameInfo , handleMove , handleStreamComplete ] ,
239224 )
240225
241226 useEffect ( ( ) => {
0 commit comments