Fix stale selection state and shelf view not updating after edits (#2996)
* Clear selection after metadata dialog close to fix stale selection state * Make shelf view use live bookState$ so unshelved books disappear immediately --------- Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
+1
-10
@@ -144,16 +144,7 @@ export class BookBrowserEntityService {
|
||||
}
|
||||
|
||||
private fetchShelfBooks(shelfId: number, sortOption: SortOption): Observable<BookState> {
|
||||
return this.shelfService.getBooksOnShelf(shelfId).pipe(
|
||||
map(books => {
|
||||
const sortedBooks = this.sortService.applySort(books, sortOption);
|
||||
return {
|
||||
books: sortedBooks,
|
||||
loaded: true,
|
||||
error: null
|
||||
};
|
||||
})
|
||||
);
|
||||
return this.fetchBooks(book => book.shelves?.some(s => s.id === shelfId) ?? false, sortOption);
|
||||
}
|
||||
|
||||
private fetchMagicShelfBooks(magicShelfId: number, sortOption: SortOption): Observable<BookState> {
|
||||
|
||||
+17
-2
@@ -822,6 +822,11 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
lockUnlockMetadata(): void {
|
||||
this.dynamicDialogRef = this.dialogHelperService.openLockUnlockMetadataDialog(this.selectedBooks);
|
||||
if (this.dynamicDialogRef) {
|
||||
this.dynamicDialogRef.onClose.subscribe(() => {
|
||||
this.bookSelectionService.deselectAll();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
autoFetchMetadata(): void {
|
||||
@@ -837,11 +842,21 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
bulkEditMetadata(): void {
|
||||
this.dialogHelperService.openBulkMetadataEditDialog(this.selectedBooks);
|
||||
this.dynamicDialogRef = this.dialogHelperService.openBulkMetadataEditDialog(this.selectedBooks);
|
||||
if (this.dynamicDialogRef) {
|
||||
this.dynamicDialogRef.onClose.subscribe(() => {
|
||||
this.bookSelectionService.deselectAll();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
multiBookEditMetadata(): void {
|
||||
this.dialogHelperService.openMultibookMetadataEditorDialog(this.selectedBooks);
|
||||
this.dynamicDialogRef = this.dialogHelperService.openMultibookMetadataEditorDialog(this.selectedBooks);
|
||||
if (this.dynamicDialogRef) {
|
||||
this.dynamicDialogRef.onClose.subscribe(() => {
|
||||
this.bookSelectionService.deselectAll();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
regenerateCoversForSelected(): void {
|
||||
|
||||
@@ -673,6 +673,11 @@ export class SeriesPageComponent implements OnDestroy, AfterViewChecked {
|
||||
|
||||
lockUnlockMetadata(): void {
|
||||
this.dialogRef = this.dialogHelperService.openLockUnlockMetadataDialog(this.selectedBooks);
|
||||
if (this.dialogRef) {
|
||||
this.dialogRef.onClose.subscribe(() => {
|
||||
this.deselectAllBooks();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
autoFetchMetadata(): void {
|
||||
@@ -688,11 +693,21 @@ export class SeriesPageComponent implements OnDestroy, AfterViewChecked {
|
||||
}
|
||||
|
||||
bulkEditMetadata(): void {
|
||||
this.dialogHelperService.openBulkMetadataEditDialog(this.selectedBooks);
|
||||
this.dialogRef = this.dialogHelperService.openBulkMetadataEditDialog(this.selectedBooks);
|
||||
if (this.dialogRef) {
|
||||
this.dialogRef.onClose.subscribe(() => {
|
||||
this.deselectAllBooks();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
multiBookEditMetadata(): void {
|
||||
this.dialogHelperService.openMultibookMetadataEditorDialog(this.selectedBooks);
|
||||
this.dialogRef = this.dialogHelperService.openMultibookMetadataEditorDialog(this.selectedBooks);
|
||||
if (this.dialogRef) {
|
||||
this.dialogRef.onClose.subscribe(() => {
|
||||
this.deselectAllBooks();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
regenerateCoversForSelected(): void {
|
||||
|
||||
Reference in New Issue
Block a user