Show a persistent loader while a large library is being created (#2200)

Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
ACX
2026-01-07 18:10:53 -07:00
committed by GitHub
co-authored by acx10
parent 251fe65ec0
commit c17fe58f4c
17 changed files with 567 additions and 111 deletions
@@ -22,6 +22,13 @@ export class LibraryService {
error: null,
});
private largeLibraryLoadingSubject = new BehaviorSubject<{ isLoading: boolean; expectedCount: number }>({
isLoading: false,
expectedCount: 0
});
largeLibraryLoading$ = this.largeLibraryLoadingSubject.asObservable();
private loading$: Observable<Library[]> | null = null;
constructor() {
@@ -72,6 +79,10 @@ export class LibraryService {
);
}
scanLibraryPaths(lib: Library): Observable<number> {
return this.http.post<number>(`${this.url}/scan`, lib);
}
createLibrary(lib: Library): Observable<Library> {
return this.http.post<Library>(this.url, lib).pipe(
map(created => {
@@ -150,4 +161,8 @@ export class LibraryService {
map(state => (state.books || []).filter(b => b.libraryId === libraryId).length)
);
}
setLargeLibraryLoading(isLoading: boolean, expectedCount: number): void {
this.largeLibraryLoadingSubject.next({ isLoading, expectedCount });
}
}