refactor(ui): move large library processing screen to notifications (#1428)

Co-authored-by: Alex <25013571+alexhb1@users.noreply.github.com>
This commit is contained in:
brios
2026-05-22 15:57:07 +01:00
committed by GitHub
co-authored by Alex
parent 0e76b381aa
commit dbbc7c3878
20 changed files with 334 additions and 427 deletions
@@ -95,7 +95,7 @@ describe('LibraryService', () => {
expect(queryClientHarness.queryClient.removeQueries).toHaveBeenCalledWith({queryKey: libraryFormatCountsQueryKey(4), exact: true});
});
it('hydrates format counts through ensureQueryData and tracks large-library loading state', async () => {
it('hydrates format counts through ensureQueryData', async () => {
httpTestingController.expectOne(req => req.url.endsWith('/api/v1/libraries')).flush([]);
const resultPromise = new Promise<Record<string, number>>((resolve, reject) => {
@@ -109,9 +109,6 @@ describe('LibraryService', () => {
await expect(resultPromise).resolves.toEqual({EPUB: 7, PDF: 2});
service.setLargeLibraryLoading(true, 2500);
expect(service.largeLibraryLoading()).toEqual({isLoading: true, expectedCount: 2500});
bookService.books.mockReturnValue([
{libraryId: 8, shelves: []},
{libraryId: 8, shelves: []},
@@ -1,4 +1,4 @@
import {computed, effect, inject, Injectable, signal} from '@angular/core';
import {computed, effect, inject, Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {from, lastValueFrom, Observable} from 'rxjs';
import {tap} from 'rxjs/operators';
@@ -20,11 +20,6 @@ export class LibraryService {
private queryClient = inject(QueryClient);
private readonly token = this.authService.token;
readonly largeLibraryLoading = signal<{ isLoading: boolean; expectedCount: number }>({
isLoading: false,
expectedCount: 0
});
private librariesQuery = injectQuery(() => ({
...this.getLibrariesQueryOptions(),
enabled: !!this.token(),
@@ -140,10 +135,6 @@ export class LibraryService {
return counts;
});
setLargeLibraryLoading(isLoading: boolean, expectedCount: number): void {
this.largeLibraryLoading.set({ isLoading, expectedCount });
}
getBookCountsByFormat(libraryId: number): Observable<Record<string, number>> {
return from(this.queryClient.ensureQueryData(this.getLibraryFormatCountsQueryOptions(libraryId)));
}