[#211] Refresh Library after a update (#212)

Library had to be refreshed manually to see the latest manga updates.
This commit is contained in:
Daniel
2023-01-06 17:35:26 +01:00
committed by GitHub
parent dca968fdb7
commit 7642b5808c
3 changed files with 37 additions and 10 deletions

View File

@@ -79,18 +79,18 @@ const sortManga = (
return result;
};
const LibraryMangaGrid: React.FC<IMangaGridProps> = ({
mangas, isLoading, hasNextPage, lastPageNum, setLastPageNum, message,
const LibraryMangaGrid: React.FC<IMangaGridProps & { lastLibraryUpdate: number }> = ({
mangas, isLoading, hasNextPage, lastPageNum, setLastPageNum, message, lastLibraryUpdate,
}) => {
const [query] = useQueryParam('query', StringParam);
const { options } = useLibraryOptionsContext();
const { unread, downloaded } = options;
const sortedManga = useMemo(() => sortManga(mangas, options.sorts, options.sortDesc),
[mangas, options.sorts, options.sortDesc]);
[mangas, lastLibraryUpdate, options.sorts, options.sortDesc]);
const filteredManga = useMemo(() => filterManga(sortedManga, query, unread, downloaded),
[sortedManga, query, unread, downloaded]);
[sortedManga, lastLibraryUpdate, query, unread, downloaded]);
const showFilteredOutMessage = (unread != null || downloaded != null || query)
&& filteredManga.length === 0 && mangas.length > 0;