fix(loading): update loading checks to use signal() for reactive state management (#727)
This commit is contained in:
@@ -99,7 +99,7 @@
|
||||
<!-- Scrollable Content Area -->
|
||||
<div class="entries-scroll-area">
|
||||
<!-- Loading State -->
|
||||
@if (loading) {
|
||||
@if (loading()) {
|
||||
<div class="settings-card">
|
||||
<div class="state-container">
|
||||
<i class="pi pi-spin pi-spinner"></i>
|
||||
@@ -108,7 +108,7 @@
|
||||
}
|
||||
|
||||
<!-- Empty State: No annotations at all -->
|
||||
@if (!loading && totalEntries === 0 && !searchQuery.trim() && selectedBookId === null && showHighlights && showNotes && showBookmarks) {
|
||||
@if (!loading() && totalEntries === 0 && !searchQuery.trim() && selectedBookId === null && showHighlights && showNotes && showBookmarks) {
|
||||
<div class="settings-card">
|
||||
<div class="state-container">
|
||||
<div class="state-icon">
|
||||
@@ -121,7 +121,7 @@
|
||||
}
|
||||
|
||||
<!-- Empty State: No results match filters -->
|
||||
@if (!loading && totalEntries === 0 && (searchQuery.trim() || selectedBookId !== null || !showHighlights || !showNotes || !showBookmarks)) {
|
||||
@if (!loading() && totalEntries === 0 && (searchQuery.trim() || selectedBookId !== null || !showHighlights || !showNotes || !showBookmarks)) {
|
||||
<div class="settings-card">
|
||||
<div class="state-container">
|
||||
<div class="state-icon warn">
|
||||
@@ -133,7 +133,7 @@
|
||||
}
|
||||
|
||||
<!-- Book Groups -->
|
||||
@if (!loading && filteredGroups.length > 0) {
|
||||
@if (!loading() && filteredGroups.length > 0) {
|
||||
@for (group of filteredGroups; track group.bookId) {
|
||||
<div class="settings-card book-group-card">
|
||||
<!-- Book Header -->
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component, DestroyRef, inject, OnInit} from '@angular/core';
|
||||
import {Component, DestroyRef, inject, OnInit, signal} from '@angular/core';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {of, Subject} from 'rxjs';
|
||||
import {debounceTime, switchMap} from 'rxjs/operators';
|
||||
@@ -62,7 +62,7 @@ export class NotebookComponent implements OnInit {
|
||||
|
||||
filteredGroups: BookGroup[] = [];
|
||||
totalEntries = 0;
|
||||
loading = true;
|
||||
loading = signal(true);
|
||||
exporting = false;
|
||||
|
||||
searchQuery = '';
|
||||
@@ -89,7 +89,7 @@ export class NotebookComponent implements OnInit {
|
||||
if (types.length === 0) {
|
||||
return of(EMPTY_PAGE);
|
||||
}
|
||||
this.loading = true;
|
||||
this.loading.set(true);
|
||||
return this.notebookService.getNotebookEntries(
|
||||
this.page, this.pageSize, types, this.selectedBookId, this.searchQuery, this.sortDirection
|
||||
);
|
||||
@@ -98,7 +98,7 @@ export class NotebookComponent implements OnInit {
|
||||
).subscribe(result => {
|
||||
this.totalEntries = result.page.totalElements;
|
||||
this.groupEntries(result.content);
|
||||
this.loading = false;
|
||||
this.loading.set(false);
|
||||
});
|
||||
|
||||
this.searchSubject.pipe(
|
||||
|
||||
Reference in New Issue
Block a user