Reduce requested category data in queries

This commit is contained in:
schroda
2024-07-01 21:40:27 +02:00
parent 03cfc9b80c
commit 9b8ace003d
19 changed files with 253 additions and 73 deletions

View File

@@ -25,6 +25,8 @@ import { CheckboxInput } from '@/components/atoms/CheckboxInput.tsx';
import { makeToast } from '@/components/util/Toast.tsx';
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
import { updateMetadataServerSettings } from '@/lib/metadata/metadataServerSettings.ts';
import { GetCategoriesBaseQuery, GetCategoriesBaseQueryVariables } from '@/lib/graphql/generated/graphql.ts';
import { GET_CATEGORIES_BASE } from '@/lib/graphql/queries/CategoryQuery.ts';
type BaseProps = {
open: boolean;
@@ -88,7 +90,9 @@ export function CategorySelect(props: CategorySelectProps) {
const [doNotShowAddToLibraryDialogAgain, setDoNotShowAddToLibraryDialogAgain] = useState(false);
const mangaCategoryIds = useGetMangaCategoryIds(mangaId);
const { data } = requestManager.useGetCategories();
const { data } = requestManager.useGetCategories<GetCategoriesBaseQuery, GetCategoriesBaseQueryVariables>(
GET_CATEGORIES_BASE,
);
const categoriesData = data?.categories.nodes;
const allCategories = useMemo(() => Categories.getUserCreated(categoriesData ?? []), [categoriesData]);