11import { CommonModule } from '@angular/common' ;
2- import { afterNextRender , ChangeDetectionStrategy , Component , DestroyRef , ElementRef , inject , signal , viewChild , HostListener } from '@angular/core' ;
2+ import { afterNextRender , ChangeDetectionStrategy , Component , DestroyRef , ElementRef , HostListener , inject , signal , viewChild } from '@angular/core' ;
33import { takeUntilDestroyed , toObservable } from '@angular/core/rxjs-interop' ;
44import { VirtualScrollerComponent , VirtualScrollerModule } from '@iharbeck/ngx-virtual-scroller' ;
55import { LucideAngularModule } from 'lucide-angular' ;
@@ -9,8 +9,8 @@ import { ContextMenuComponent } from '../../../_components/context-menu/context-
99import { LogDetailsModalComponent } from '../../../_components/log-details-modal/log-details-modal.component' ;
1010import { TimestampFormatPipe } from '../../../_pipes/timestamp-format.pipe' ;
1111import { LogApiService } from '../../../_services/log.api' ;
12- import { ViewModeService } from '../../../_services/view-mode.service' ;
1312import { Log , SignalRService } from '../../../_services/signalr.service' ;
13+ import { ViewModeService } from '../../../_services/view-mode.service' ;
1414import { HighlightLogPipe , LogLevelPipe } from '../_services/highlight.directive' ;
1515import { LogFilterState } from '../_services/log-filter-state' ;
1616@Component ( {
@@ -257,18 +257,18 @@ export class LogViewportComponent {
257257 podColor : getPodColor ( z . pod ) ,
258258 view : this . cleanLogLine ( z . line ) ,
259259 } ;
260- } ) . sort ( ( a , b ) => {
260+ } ) ;
261+
262+ this . logs . update ( ( x ) => {
263+ const newLogs = [ ...x , ...filteredLogs , ] . sort ( ( a , b ) => {
261264
262265 var timedif = new Date ( b . timeStamp ) . getTime ( ) - new Date ( a . timeStamp ) . getTime ( ) ;
263266 if ( timedif > 0 ) return 1 ;
264267 if ( timedif < 0 ) return - 1 ;
265268 if ( a . id > b . id ) return 1 ;
266269 if ( a . id < b . id ) return - 1 ;
267270 return 0 ;
268- } ) ;
269-
270- this . logs . update ( ( x ) => {
271- const newLogs = [ ...filteredLogs , ...x ] ;
271+ } ) ;
272272 // Trim logs if we exceed memory limit
273273 if ( newLogs . length > this . MAX_LOGS_IN_MEMORY ) {
274274 return newLogs . slice ( 0 , this . MAX_LOGS_IN_MEMORY ) ;
0 commit comments