fix(dashboard): improve performance with OnPush change detection (#440)
* fix(dashboard): improve performance with OnPush change detection * fix(dashboard): refactor book card component for improved readability and performance * fix(tests): mock matchMedia for improved test compatibility * fix(tests): matchMedia mock for better CI compatibility and support * fix(dashboard): add clearAll method to BookBrowserScrollService and update tests * fix(dashboard): improve performance with content visibility and refactor styles * fix(dashboard): improve scroll performance with estimated total height and refactor layout * fix(tests): add mock for getCurrentUser in userService for improved test coverage * fix(dashboard): implement infinite scroll for book loading and scroll restoration * fix(tests): fix lint error * fix(tests): mock ResizeObserver and IntersectionObserver * fix(tests): mock ResizeObserver and IntersectionObserver (again) * fix(dashboard): improve accessibility and performance by updating aria attributes and optimizing animations * fix(dashboard): improve submenu accessibility and optimize virtual scroller performance * fix(dashboard): clean up imports and improve component structure * fix(dashboard): correct mobile check in author browser component * fix(dashboard): add OnDestroy lifecycle hook to BookBrowserComponent
This commit is contained in:
+7
-10
@@ -1,9 +1,8 @@
|
||||
import {Component, inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {Subject} from 'rxjs';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {Component, DestroyRef, inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {KeyValuePipe} from '@angular/common';
|
||||
import {ProgressBarModule} from 'primeng/progressbar';
|
||||
import {ButtonModule} from 'primeng/button';
|
||||
import {ProgressBar} from 'primeng/progressbar';
|
||||
import {Button} from 'primeng/button';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {MessageService} from 'primeng/api';
|
||||
@@ -21,12 +20,12 @@ import {DialogLauncherService} from '../../services/dialog-launcher.service';
|
||||
templateUrl: './metadata-progress-widget-component.html',
|
||||
styleUrls: ['./metadata-progress-widget-component.scss'],
|
||||
standalone: true,
|
||||
imports: [KeyValuePipe, ProgressBarModule, ButtonModule, Divider, Tooltip, Tag, TranslocoDirective]
|
||||
imports: [KeyValuePipe, ProgressBar, Button, Divider, Tooltip, Tag, TranslocoDirective]
|
||||
})
|
||||
export class MetadataProgressWidgetComponent implements OnInit, OnDestroy {
|
||||
activeTasks: Record<string, MetadataBatchProgressNotification> = {};
|
||||
|
||||
private destroy$ = new Subject<void>();
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private dialogLauncherService = inject(DialogLauncherService);
|
||||
private metadataProgressService = inject(MetadataProgressService);
|
||||
private metadataTaskService = inject(MetadataTaskService);
|
||||
@@ -40,7 +39,7 @@ export class MetadataProgressWidgetComponent implements OnInit, OnDestroy {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.metadataProgressService.activeTasks$
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe(tasks => {
|
||||
this.activeTasks = tasks;
|
||||
this.checkForStalledTasks(tasks);
|
||||
@@ -137,8 +136,6 @@ export class MetadataProgressWidgetComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
for (const timeout of this.timeoutHandles.values()) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user