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:
@@ -1,5 +1,5 @@
|
||||
import {Component, inject, OnInit, OnDestroy} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {Component, DestroyRef, inject, OnInit} from '@angular/core';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {TableLazyLoadEvent, TableModule} from 'primeng/table';
|
||||
import {Select} from 'primeng/select';
|
||||
@@ -9,6 +9,7 @@ import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {Subscription, interval} from 'rxjs';
|
||||
import {AuditLog, AuditLogService} from './audit-log.service';
|
||||
import {TagColor, TagComponent} from '../../../shared/components/tag/tag.component';
|
||||
import {DatePipe} from '@angular/common';
|
||||
|
||||
const ACTION_COLOR_GROUPS: [TagColor, string[]][] = [
|
||||
['red', ['USER_DELETED', 'LIBRARY_DELETED', 'BOOK_DELETED', 'SHELF_DELETED', 'MAGIC_SHELF_DELETED', 'EMAIL_PROVIDER_DELETED', 'OPDS_USER_DELETED', 'AUTHOR_DELETED']],
|
||||
@@ -40,11 +41,12 @@ interface UsernameOption {
|
||||
@Component({
|
||||
selector: 'app-audit-logs',
|
||||
standalone: true,
|
||||
imports: [CommonModule, TableModule, Select, DatePicker, FormsModule, TranslocoDirective, TagComponent],
|
||||
imports: [
|
||||
DatePipe,TableModule, Select, DatePicker, FormsModule, TranslocoDirective, TagComponent],
|
||||
templateUrl: './audit-logs.component.html',
|
||||
styleUrl: './audit-logs.component.scss'
|
||||
})
|
||||
export class AuditLogsComponent implements OnInit, OnDestroy {
|
||||
export class AuditLogsComponent implements OnInit {
|
||||
private readonly auditLogService = inject(AuditLogService);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly router = inject(Router);
|
||||
@@ -59,6 +61,7 @@ export class AuditLogsComponent implements OnInit, OnDestroy {
|
||||
expandedRows = new Set<number>();
|
||||
autoRefresh = false;
|
||||
private autoRefreshSub?: Subscription;
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
usernameOptions: UsernameOption[] = [{label: 'All Users', value: ''}];
|
||||
|
||||
@@ -111,10 +114,6 @@ export class AuditLogsComponent implements OnInit, OnDestroy {
|
||||
this.loadLogs();
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.autoRefreshSub?.unsubscribe();
|
||||
}
|
||||
|
||||
loadUsernames(): void {
|
||||
this.auditLogService.getDistinctUsernames().subscribe({
|
||||
next: (usernames) => {
|
||||
@@ -168,7 +167,9 @@ export class AuditLogsComponent implements OnInit, OnDestroy {
|
||||
toggleAutoRefresh(): void {
|
||||
this.autoRefresh = !this.autoRefresh;
|
||||
if (this.autoRefresh) {
|
||||
this.autoRefreshSub = interval(10000).subscribe(() => this.loadLogs(false));
|
||||
this.autoRefreshSub = interval(10000)
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe(() => this.loadLogs(false));
|
||||
} else {
|
||||
this.autoRefreshSub?.unsubscribe();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {Component, inject, OnInit} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {Component, DestroyRef, inject, OnInit} from '@angular/core';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {take} from 'rxjs/operators';
|
||||
import {Button} from 'primeng/button';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {CustomFontService} from '../../../shared/service/custom-font.service';
|
||||
@@ -12,11 +13,13 @@ import {FontUploadDialogComponent} from './font-upload-dialog/font-upload-dialog
|
||||
import {Skeleton} from 'primeng/skeleton';
|
||||
import {DialogSize, DialogStyle} from '../../../shared/services/dialog-launcher.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
import {DatePipe} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-custom-fonts',
|
||||
standalone: true,
|
||||
imports: [CommonModule, Button, ConfirmDialog, Tooltip, Skeleton, TranslocoDirective],
|
||||
imports: [
|
||||
DatePipe,Button, ConfirmDialog, Tooltip, Skeleton, TranslocoDirective],
|
||||
templateUrl: './custom-fonts.component.html',
|
||||
styleUrls: ['./custom-fonts.component.scss'],
|
||||
providers: [ConfirmationService, DialogService]
|
||||
@@ -34,6 +37,7 @@ export class CustomFontsComponent implements OnInit {
|
||||
private confirmationService = inject(ConfirmationService);
|
||||
private dialogService = inject(DialogService);
|
||||
private t = inject(TranslocoService);
|
||||
private destroyRef = inject(DestroyRef);
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadFonts();
|
||||
@@ -82,7 +86,7 @@ export class CustomFontsComponent implements OnInit {
|
||||
});
|
||||
|
||||
if (this.uploadDialogRef) {
|
||||
this.uploadDialogRef.onClose.subscribe((font: CustomFont | null) => {
|
||||
this.uploadDialogRef.onClose.pipe(take(1), takeUntilDestroyed(this.destroyRef)).subscribe((font: CustomFont | null) => {
|
||||
if (font) {
|
||||
this.customFonts.push(font);
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
import {Component, ViewChild, ElementRef, OnDestroy, inject} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {Button} from 'primeng/button';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {CustomFontService} from '../../../../shared/service/custom-font.service';
|
||||
@@ -12,7 +11,7 @@ import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/tran
|
||||
@Component({
|
||||
selector: 'app-font-upload-dialog',
|
||||
standalone: true,
|
||||
imports: [CommonModule, Button, InputText, FormsModule, TranslocoDirective, TranslocoPipe],
|
||||
imports: [Button, InputText, FormsModule, TranslocoDirective, TranslocoPipe],
|
||||
templateUrl: './font-upload-dialog.component.html',
|
||||
styleUrls: ['./font-upload-dialog.component.scss']
|
||||
})
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ import {FormsModule} from '@angular/forms';
|
||||
import {InputText} from 'primeng/inputtext';
|
||||
import {ToggleSwitch} from 'primeng/toggleswitch';
|
||||
import {Button} from 'primeng/button';
|
||||
import {ToastModule} from 'primeng/toast';
|
||||
import {Toast} from 'primeng/toast';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {ExternalDocLinkComponent} from '../../../../../shared/components/external-doc-link/external-doc-link.component';
|
||||
import {UserService} from '../../../user-management/user.service';
|
||||
@@ -18,7 +18,7 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
InputText,
|
||||
ToggleSwitch,
|
||||
Button,
|
||||
ToastModule,
|
||||
Toast,
|
||||
ExternalDocLinkComponent,
|
||||
TranslocoDirective
|
||||
],
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import {SettingsHelperService} from '../../../../../shared/service/settings-help
|
||||
import {AppSettingKey, KoboSettings} from '../../../../../shared/model/app-settings.model';
|
||||
import {ShelfService} from '../../../../book/service/shelf.service';
|
||||
import {ExternalDocLinkComponent} from '../../../../../shared/components/external-doc-link/external-doc-link.component';
|
||||
import {ToastModule} from 'primeng/toast';
|
||||
import {Toast} from 'primeng/toast';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
@Component({
|
||||
@@ -24,7 +24,7 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
standalone: true,
|
||||
templateUrl: './kobo-sync-settings-component.html',
|
||||
styleUrl: './kobo-sync-settings-component.scss',
|
||||
imports: [FormsModule, Button, InputText, ConfirmDialog, ToggleSwitch, Slider, Divider, ExternalDocLinkComponent, ToastModule, TranslocoDirective],
|
||||
imports: [FormsModule, Button, InputText, ConfirmDialog, ToggleSwitch, Slider, Divider, ExternalDocLinkComponent, Toast, TranslocoDirective],
|
||||
providers: [MessageService, ConfirmationService]
|
||||
})
|
||||
export class KoboSyncSettingsComponent implements OnInit, OnDestroy {
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import {FormsModule} from '@angular/forms';
|
||||
import {InputText} from 'primeng/inputtext';
|
||||
import {ToggleSwitch} from 'primeng/toggleswitch';
|
||||
import {Button} from 'primeng/button';
|
||||
import {ToastModule} from 'primeng/toast';
|
||||
import {Toast} from 'primeng/toast';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {KoreaderService} from './koreader.service';
|
||||
import {UserService} from '../../../user-management/user.service';
|
||||
@@ -19,7 +19,7 @@ import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/tran
|
||||
InputText,
|
||||
ToggleSwitch,
|
||||
Button,
|
||||
ToastModule,
|
||||
Toast,
|
||||
ExternalDocLinkComponent,
|
||||
TranslocoDirective,
|
||||
TranslocoPipe
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ import {MessageService} from 'primeng/api';
|
||||
import {AppSettingKey} from '../../../../shared/model/app-settings.model';
|
||||
import {Select} from 'primeng/select';
|
||||
import {ExternalDocLinkComponent} from '../../../../shared/components/external-doc-link/external-doc-link.component';
|
||||
import { ToggleSwitchModule } from 'primeng/toggleswitch';
|
||||
import { ToggleSwitch } from 'primeng/toggleswitch';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
@Component({
|
||||
@@ -21,7 +21,7 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
FormsModule,
|
||||
Select,
|
||||
ExternalDocLinkComponent,
|
||||
ToggleSwitchModule,
|
||||
ToggleSwitch,
|
||||
TranslocoDirective
|
||||
],
|
||||
templateUrl: './metadata-provider-settings.component.html',
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
import {Component, effect, inject} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {AccordionModule} from 'primeng/accordion';
|
||||
import {Accordion, AccordionPanel, AccordionHeader, AccordionContent} from 'primeng/accordion';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {Button} from 'primeng/button';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
@@ -19,7 +18,7 @@ import {SidecarService} from '../../metadata/service/sidecar.service';
|
||||
@Component({
|
||||
selector: 'app-library-metadata-settings-component',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, MetadataAdvancedFetchOptionsComponent, AccordionModule, ExternalDocLinkComponent, Button, Tooltip, TranslocoDirective],
|
||||
imports: [FormsModule, MetadataAdvancedFetchOptionsComponent, Accordion, AccordionPanel, AccordionHeader, AccordionContent, ExternalDocLinkComponent, Button, Tooltip, TranslocoDirective],
|
||||
templateUrl: './library-metadata-settings.component.html',
|
||||
styleUrls: ['./library-metadata-settings.component.scss']
|
||||
})
|
||||
|
||||
+2
-2
@@ -4,14 +4,14 @@ import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {clampStripMaxWidthPercent} from '../../../readers/cbx-reader/core/cbx-reader-storage';
|
||||
import {CbxBackgroundColor, CbxFitMode, CbxPageSpread, CbxPageViewMode, CbxScrollMode, UserSettings} from '../../user-management/user.service';
|
||||
import {ReaderPreferencesService} from '../reader-preferences.service';
|
||||
import {TooltipModule} from 'primeng/tooltip';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cbx-reader-preferences-component',
|
||||
imports: [
|
||||
FormsModule,
|
||||
TranslocoDirective,
|
||||
TooltipModule
|
||||
Tooltip
|
||||
],
|
||||
templateUrl: './cbx-reader-preferences-component.html',
|
||||
styleUrl: './cbx-reader-preferences-component.scss'
|
||||
|
||||
+2
-2
@@ -3,14 +3,14 @@ import {FormsModule} from '@angular/forms';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {ReaderPreferencesService} from '../reader-preferences.service';
|
||||
import {PageSpread, UserSettings} from '../../user-management/user.service';
|
||||
import {TooltipModule} from 'primeng/tooltip';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pdf-reader-preferences-component',
|
||||
imports: [
|
||||
FormsModule,
|
||||
TranslocoDirective,
|
||||
TooltipModule
|
||||
Tooltip
|
||||
],
|
||||
templateUrl: './pdf-reader-preferences-component.html',
|
||||
styleUrl: './pdf-reader-preferences-component.scss'
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import {Component, effect, inject} from '@angular/core';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
|
||||
import {TooltipModule} from 'primeng/tooltip';
|
||||
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {UserService, UserSettings} from '../user-management/user.service';
|
||||
import {EpubReaderPreferencesComponent} from './epub-reader-preferences/epub-reader-preferences-component';
|
||||
@@ -16,7 +16,7 @@ import {LocalSettingsComponent} from "./local-settings/local-settings.component"
|
||||
templateUrl: './reader-preferences.component.html',
|
||||
standalone: true,
|
||||
styleUrls: ['./reader-preferences.component.scss'],
|
||||
imports: [FormsModule, TooltipModule, TranslocoDirective, EpubReaderPreferencesComponent, PdfReaderPreferencesComponent, CbxReaderPreferencesComponent, CustomFontsComponent, SettingsApplicationModeComponent, LocalSettingsComponent]
|
||||
imports: [FormsModule, TranslocoDirective, EpubReaderPreferencesComponent, PdfReaderPreferencesComponent, CbxReaderPreferencesComponent, CustomFontsComponent, SettingsApplicationModeComponent, LocalSettingsComponent]
|
||||
})
|
||||
export class ReaderPreferences {
|
||||
private readonly userService = inject(UserService);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {Component, inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {Component, DestroyRef, inject, OnInit} from '@angular/core';
|
||||
import {Button} from 'primeng/button';
|
||||
import {ProgressBar} from 'primeng/progressbar';
|
||||
import {MessageService} from 'primeng/api';
|
||||
@@ -19,17 +18,19 @@ import {
|
||||
TaskType
|
||||
} from './task.service';
|
||||
import {MetadataRefreshRequest} from '../../metadata/model/request/metadata-refresh-request.model';
|
||||
import {finalize, forkJoin, Subscription} from 'rxjs';
|
||||
import {finalize, forkJoin} from 'rxjs';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-link/external-doc-link.component';
|
||||
import {ToggleSwitch} from 'primeng/toggleswitch';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
|
||||
import {NgClass} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-task-management',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
NgClass,
|
||||
Button,
|
||||
ProgressBar,
|
||||
Select,
|
||||
@@ -43,18 +44,18 @@ import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/tran
|
||||
templateUrl: './task-management.component.html',
|
||||
styleUrl: './task-management.component.scss'
|
||||
})
|
||||
export class TaskManagementComponent implements OnInit, OnDestroy {
|
||||
export class TaskManagementComponent implements OnInit {
|
||||
// Services
|
||||
private messageService = inject(MessageService);
|
||||
private taskService = inject(TaskService);
|
||||
private t = inject(TranslocoService);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
// State
|
||||
taskInfos: TaskInfo[] = [];
|
||||
taskHistories = new Map<string, TaskHistory>();
|
||||
loading = false;
|
||||
executingTasks = new Set<string>();
|
||||
private subscription?: Subscription;
|
||||
|
||||
// Metadata Replace Options
|
||||
metadataReplaceOptions = [
|
||||
@@ -92,10 +93,6 @@ export class TaskManagementComponent implements OnInit, OnDestroy {
|
||||
this.subscribeToTaskProgress();
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.subscription?.unsubscribe();
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Data Loading & Real-time Updates
|
||||
// ============================================================================
|
||||
@@ -124,11 +121,13 @@ export class TaskManagementComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private subscribeToTaskProgress(): void {
|
||||
this.subscription = this.taskService.taskProgress$.subscribe(progress => {
|
||||
if (progress) {
|
||||
this.updateTaskWithProgress(progress);
|
||||
}
|
||||
});
|
||||
this.taskService.taskProgress$
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe(progress => {
|
||||
if (progress) {
|
||||
this.updateTaskWithProgress(progress);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private updateTaskWithProgress(progress: TaskProgressPayload): void {
|
||||
|
||||
-2
@@ -1,5 +1,4 @@
|
||||
import {Component, computed, EventEmitter, inject, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Button} from 'primeng/button';
|
||||
import {Select} from 'primeng/select';
|
||||
@@ -20,7 +19,6 @@ import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/tran
|
||||
selector: 'app-content-restrictions-editor',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
Button,
|
||||
Select,
|
||||
|
||||
+8
-4
@@ -1,8 +1,9 @@
|
||||
import {Component, inject, OnInit} from '@angular/core';
|
||||
import {Component, DestroyRef, inject, OnInit} from '@angular/core';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {InputText} from 'primeng/inputtext';
|
||||
import {FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators} from '@angular/forms';
|
||||
import {Checkbox} from 'primeng/checkbox';
|
||||
import {MultiSelectModule} from 'primeng/multiselect';
|
||||
import {MultiSelect} from 'primeng/multiselect';
|
||||
import {Library} from '../../../book/model/library.model';
|
||||
import {Button} from 'primeng/button';
|
||||
import {LibraryService} from '../../../book/service/library.service';
|
||||
@@ -21,7 +22,7 @@ import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/tran
|
||||
ReactiveFormsModule,
|
||||
FormsModule,
|
||||
Checkbox,
|
||||
MultiSelectModule,
|
||||
MultiSelect,
|
||||
Button,
|
||||
TranslocoDirective,
|
||||
TranslocoPipe
|
||||
@@ -38,6 +39,7 @@ export class CreateUserDialogComponent implements OnInit {
|
||||
private messageService = inject(MessageService);
|
||||
private ref = inject(DynamicDialogRef);
|
||||
private t = inject(TranslocoService);
|
||||
private destroyRef = inject(DestroyRef);
|
||||
|
||||
get libraries(): Library[] {
|
||||
return this.libraryService.libraries();
|
||||
@@ -81,7 +83,9 @@ export class CreateUserDialogComponent implements OnInit {
|
||||
permissionBulkResetBookReadStatus: [false],
|
||||
}, {validators: [passwordMatchValidator('password', 'confirmPassword')]});
|
||||
|
||||
this.userForm.get('permissionAdmin')?.valueChanges.subscribe((isAdmin: boolean) => {
|
||||
this.userForm.get('permissionAdmin')?.valueChanges
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe((isAdmin: boolean) => {
|
||||
const controls = this.userForm.controls;
|
||||
Object.keys(controls).forEach(key => {
|
||||
if (key !== 'permissionAdmin' && key.startsWith('permission')) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {TestBed} from '@angular/core/testing';
|
||||
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
|
||||
|
||||
import {AuthService} from '../../../shared/service/auth.service';
|
||||
import {createAuthServiceStub, createQueryClientHarness, flushSignalAndQueryEffects} from '../../../core/testing/query-testing';
|
||||
import {createAuthServiceStub, createQueryClientHarness, flushSignalAndQueryEffects, flushQueryAsync} from '../../../core/testing/query-testing';
|
||||
import {CURRENT_USER_QUERY_KEY} from './user-query-keys';
|
||||
import {type User, type UserSettings, UserService} from './user.service';
|
||||
|
||||
@@ -117,12 +117,7 @@ function buildUser(overrides: BuildUserOverrides = {}): User {
|
||||
}
|
||||
|
||||
async function flushCurrentUserQuery(): Promise<void> {
|
||||
await Promise.resolve();
|
||||
flushSignalAndQueryEffects();
|
||||
await new Promise(resolve => setTimeout(resolve, 0));
|
||||
flushSignalAndQueryEffects();
|
||||
await Promise.resolve();
|
||||
flushSignalAndQueryEffects();
|
||||
await flushQueryAsync();
|
||||
}
|
||||
|
||||
describe('UserService', () => {
|
||||
|
||||
+1
-2
@@ -1,7 +1,7 @@
|
||||
import {Component, inject, OnInit} from '@angular/core';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {TableModule} from 'primeng/table';
|
||||
import {ToastModule} from 'primeng/toast';
|
||||
|
||||
import {ViewPreferencesComponent} from './view-preferences/view-preferences.component';
|
||||
import {SidebarSortingPreferencesComponent} from './sidebar-sorting-preferences/sidebar-sorting-preferences.component';
|
||||
import {MetaCenterViewModeComponent} from './meta-center-view-mode/meta-center-view-mode-component';
|
||||
@@ -17,7 +17,6 @@ import {LocalStorageService} from '../../../shared/service/local-storage.service
|
||||
imports: [
|
||||
FormsModule,
|
||||
TableModule,
|
||||
ToastModule,
|
||||
ViewPreferencesComponent,
|
||||
SidebarSortingPreferencesComponent,
|
||||
MetaCenterViewModeComponent,
|
||||
|
||||
+1
-2
@@ -10,7 +10,7 @@ import {ShelfService} from '../../../book/service/shelf.service';
|
||||
import {MagicShelfService} from '../../../magic-shelf/service/magic-shelf.service';
|
||||
import {Subject} from 'rxjs';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {ToastModule} from 'primeng/toast';
|
||||
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {ToggleSwitch} from 'primeng/toggleswitch';
|
||||
@@ -28,7 +28,6 @@ import {CdkDrag, CdkDragDrop, CdkDragHandle, CdkDropList, moveItemInArray} from
|
||||
FormsModule,
|
||||
Button,
|
||||
TableModule,
|
||||
ToastModule,
|
||||
Tooltip,
|
||||
ToggleSwitch,
|
||||
TranslocoDirective,
|
||||
|
||||
Reference in New Issue
Block a user