Fix missing unsubscribe

prevent potential performance issue when switching tabs too many times.
This commit is contained in:
2025-08-06 01:25:35 +02:00
parent 8885b7c0db
commit 57e8cea5d0

View File

@@ -1,5 +1,5 @@
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling' import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'
import { Component, EventEmitter, HostBinding, HostListener, OnInit, Output, ViewChild } from '@angular/core' import { Component, EventEmitter, HostBinding, HostListener, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
import { Router } from '@angular/router' import { Router } from '@angular/router'
import { Subscription } from 'rxjs' import { Subscription } from 'rxjs'
@@ -14,7 +14,7 @@ import { SelectionService } from '../../../core/services/selection.service'
templateUrl: './result-table.component.html', templateUrl: './result-table.component.html',
standalone: false, standalone: false,
}) })
export class ResultTableComponent implements OnInit { export class ResultTableComponent implements OnInit, OnDestroy {
@HostBinding('class.contents') contents = true @HostBinding('class.contents') contents = true
@Output() rowClicked = new EventEmitter<ChartData[]>() @Output() rowClicked = new EventEmitter<ChartData[]>()
@@ -125,4 +125,8 @@ export class ResultTableComponent implements OnInit {
this.viewport.checkViewportSize() this.viewport.checkViewportSize()
} }
} }
ngOnDestroy(): void {
this.subscription.forEach(sub => sub.unsubscribe())
}
} }