File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,7 +165,31 @@ const List: React.FC = () => {
165165 const startIndex = ( page - 1 ) * pageSize ;
166166 const paginatedList = combinedList . slice ( startIndex , startIndex + pageSize ) ;
167167
168- setData ( paginatedList ) ;
168+ setData ( prevData => {
169+ // Build a map of existing cloud tasks' real-time progress (driven by SSE)
170+ const existingMap = new Map < string , any > ( ) ;
171+ for ( const item of prevData ) {
172+ if ( ( item as any ) . isCloud && item . id ) {
173+ existingMap . set ( item . id , item ) ;
174+ }
175+ }
176+ // Merge: for cloud tasks already in state, take Math.max of progress fields
177+ // to prevent API lag from overwriting SSE real-time updates
178+ return paginatedList . map ( task => {
179+ if ( ( task as any ) . isCloud && task . id ) {
180+ const existing = existingMap . get ( task . id ) ;
181+ if ( existing ) {
182+ return {
183+ ...task ,
184+ progress : Math . max ( task . progress || 0 , existing . progress || 0 ) ,
185+ completed_count : Math . max ( task . completed_count || 0 , existing . completed_count || 0 ) ,
186+ failed_count : Math . max ( task . failed_count || 0 , existing . failed_count || 0 ) ,
187+ } ;
188+ }
189+ }
190+ return task ;
191+ } ) ;
192+ } ) ;
169193 setPagination ( prev => ( {
170194 ...prev ,
171195 current : page ,
You can’t perform that action at this time.
0 commit comments