Skip to content

Commit

Permalink
Remove unnecessary library refetch
Browse files Browse the repository at this point in the history
The server is now returning up-to-date manga data and thus, it's not necessary to refetch the library anymore after the update is finished
  • Loading branch information
schroda committed Dec 16, 2023
1 parent 12b6700 commit 1300c10
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/screens/Library.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { Chip, Tab, Tabs, styled, Box } from '@mui/material';
import React, { useCallback, useContext, useEffect, useMemo } from 'react';
import React, { useContext, useEffect, useMemo } from 'react';
import { useQueryParam, NumberParam } from 'use-query-params';
import { useTranslation } from 'react-i18next';
import { requestManager } from '@/lib/requests/RequestManager.ts';
Expand Down Expand Up @@ -66,7 +66,6 @@ export function Library() {
data: categoriesResponse,
error: tabsError,
loading: areCategoriesLoading,
refetch,
} = requestManager.useGetCategories();
const tabsData = categoriesResponse?.categories.nodes.filter(
(category) => category.id !== 0 || (category.id === 0 && category.mangas.totalCount),
Expand All @@ -87,10 +86,6 @@ export function Library() {
} = requestManager.useGetCategoryMangas(activeTab?.id, { skip: !activeTab, nextFetchPolicy: 'cache-only' });
const mangas = categoryMangaResponse?.mangas.nodes ?? [];

const handleFinishedUpdate = useCallback(() => {
refetch();
}, [refetch]);

const { setTitle, setAction } = useContext(NavBarContext);
useEffect(() => {
const title = t('library.title');
Expand All @@ -105,7 +100,7 @@ export function Library() {
<>
<AppbarSearch />
<LibraryToolbarMenu />
<UpdateChecker handleFinishedUpdate={handleFinishedUpdate} />
<UpdateChecker />
</>,
);
return () => {
Expand Down

0 comments on commit 1300c10

Please sign in to comment.