@@ -41,17 +41,17 @@ const HomePage: React.FC = () => {
4141 // Check if we have a stored team and if it still exists in the backend
4242 const storedTeam = TeamService . getStoredTeam ( ) ;
4343 if ( storedTeam ) {
44- const existsInBackend = teams . some ( t => t . team_id === storedTeam . team_id ) ;
45- if ( existsInBackend ) {
46- // Stored team still exists, use it
47- dispatch ( setSelectedTeam ( storedTeam ) ) ;
48- showToast ( `${ storedTeam . name } team restored from storage` , 'success' ) ;
44+ const backendTeam = teams . find ( t => t . team_id === storedTeam . team_id ) ;
45+ if ( backendTeam ) {
46+ // Stored team still exists, use backend-fresh object
47+ dispatch ( setSelectedTeam ( backendTeam ) ) ;
48+ showToast ( `${ backendTeam . name } team restored from storage` , 'success' ) ;
4949 dispatch ( setIsLoadingTeam ( false ) ) ;
5050 return ;
5151 } else {
5252 // Stored team was deleted, clear localStorage
5353 console . warn ( `Stored team ${ storedTeam . team_id } no longer exists, clearing storage` ) ;
54- // Don't call storageTeam with null, just let init response guide us
54+ TeamService . clearStoredTeam ( ) ;
5555 }
5656 }
5757
@@ -143,7 +143,7 @@ const HomePage: React.FC = () => {
143143 [ dispatch , showToast ] ,
144144 ) ;
145145
146- const handleTeamUpload = useCallback ( async ( uploadedTeam ?: any ) => {
146+ const handleTeamUpload = useCallback ( async ( uploadedTeam ?: TeamConfig ) => {
147147 try {
148148 console . log ( 'handleTeamUpload called with:' , uploadedTeam ) ;
149149 if ( uploadedTeam ) {
@@ -167,7 +167,7 @@ const HomePage: React.FC = () => {
167167 }
168168 } catch ( error ) {
169169 console . error ( 'Team upload failed:' , error ) ;
170- showToast ( 'Team upload completed ' , 'success ' ) ;
170+ showToast ( 'Team upload failed. Please try again. ' , 'warning ' ) ;
171171 }
172172 } , [ dispatch , showToast ] ) ;
173173
0 commit comments