forked from akai/readest
fix: update current bookshelf after importing and deleting books (#1331)
This commit is contained in:
@@ -68,7 +68,7 @@ const Bookshelf: React.FC<BookshelfProps> = ({
|
||||
);
|
||||
const isImportingBook = useRef(false);
|
||||
|
||||
const { currentBookshelf, setCurrentBookshelf, setLibrary } = useLibraryStore();
|
||||
const { setCurrentBookshelf, setLibrary } = useLibraryStore();
|
||||
const allBookshelfItems =
|
||||
viewMode === 'grid' ? generateGridItems(libraryBooks) : generateListItems(libraryBooks);
|
||||
|
||||
@@ -234,7 +234,8 @@ const Bookshelf: React.FC<BookshelfProps> = ({
|
||||
}
|
||||
};
|
||||
const sortOrderMultiplier = sortOrder === 'asc' ? 1 : -1;
|
||||
const filteredBookshelfItems = currentBookshelf
|
||||
const currentBookshelfItems = navBooksGroup ? navBooksGroup.books : allBookshelfItems;
|
||||
const filteredBookshelfItems = currentBookshelfItems
|
||||
.filter((item) => {
|
||||
if ('name' in item) return item.books.some((book) => bookFilter(book, queryTerm || ''));
|
||||
else if (queryTerm) return bookFilter(item, queryTerm);
|
||||
|
||||
Reference in New Issue
Block a user