1818 * Handles both existing sessions (with real IDs) and new sessions (with temporary IDs).
1919 */
2020
21- import React , { useState , useEffect } from 'react' ;
21+ import React , { useState , useEffect , useCallback } from 'react' ;
2222import { BrowserRouter as Router , Routes , Route , useNavigate , useParams } from 'react-router-dom' ;
2323import Sidebar from './components/Sidebar' ;
2424import MainContent from './components/MainContent' ;
@@ -478,47 +478,47 @@ function AppContent() {
478478
479479 // markSessionAsActive: Called when user sends a message to mark session as protected
480480 // This includes both real session IDs and temporary "new-session-*" identifiers
481- const markSessionAsActive = ( sessionId ) => {
481+ const markSessionAsActive = useCallback ( ( sessionId ) => {
482482 if ( sessionId ) {
483483 setActiveSessions ( prev => new Set ( [ ...prev , sessionId ] ) ) ;
484484 }
485- } ;
485+ } , [ ] ) ;
486486
487487 // markSessionAsInactive: Called when conversation completes/aborts to re-enable project updates
488- const markSessionAsInactive = ( sessionId ) => {
488+ const markSessionAsInactive = useCallback ( ( sessionId ) => {
489489 if ( sessionId ) {
490490 setActiveSessions ( prev => {
491491 const newSet = new Set ( prev ) ;
492492 newSet . delete ( sessionId ) ;
493493 return newSet ;
494494 } ) ;
495495 }
496- } ;
496+ } , [ ] ) ;
497497
498498 // Processing Session Functions: Track which sessions are currently thinking/processing
499499
500500 // markSessionAsProcessing: Called when Claude starts thinking/processing
501- const markSessionAsProcessing = ( sessionId ) => {
501+ const markSessionAsProcessing = useCallback ( ( sessionId ) => {
502502 if ( sessionId ) {
503503 setProcessingSessions ( prev => new Set ( [ ...prev , sessionId ] ) ) ;
504504 }
505- } ;
505+ } , [ ] ) ;
506506
507507 // markSessionAsNotProcessing: Called when Claude finishes thinking/processing
508- const markSessionAsNotProcessing = ( sessionId ) => {
508+ const markSessionAsNotProcessing = useCallback ( ( sessionId ) => {
509509 if ( sessionId ) {
510510 setProcessingSessions ( prev => {
511511 const newSet = new Set ( prev ) ;
512512 newSet . delete ( sessionId ) ;
513513 return newSet ;
514514 } ) ;
515515 }
516- } ;
516+ } , [ ] ) ;
517517
518518 // replaceTemporarySession: Called when WebSocket provides real session ID for new sessions
519519 // Removes temporary "new-session-*" identifiers and adds the real session ID
520520 // This maintains protection continuity during the transition from temporary to real session
521- const replaceTemporarySession = ( realSessionId ) => {
521+ const replaceTemporarySession = useCallback ( ( realSessionId ) => {
522522 if ( realSessionId ) {
523523 setActiveSessions ( prev => {
524524 const newSet = new Set ( ) ;
@@ -532,7 +532,7 @@ function AppContent() {
532532 return newSet ;
533533 } ) ;
534534 }
535- } ;
535+ } , [ ] ) ;
536536
537537 // Version Upgrade Modal Component
538538 const VersionUpgradeModal = ( ) => {
0 commit comments