From e90ceefc604bb58757f73c775c9fe6e040ca10fc Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Fri, 17 Oct 2025 11:13:22 +0200 Subject: [PATCH] refactor: remove loading state management and indicators from PaginatedSeriesGrid and PaginatedBookGrid components for cleaner UI --- .../library/PaginatedSeriesGrid.tsx | 31 +------------------ src/components/series/PaginatedBookGrid.tsx | 31 +------------------ 2 files changed, 2 insertions(+), 60 deletions(-) diff --git a/src/components/library/PaginatedSeriesGrid.tsx b/src/components/library/PaginatedSeriesGrid.tsx index a02ea8b..03afa06 100644 --- a/src/components/library/PaginatedSeriesGrid.tsx +++ b/src/components/library/PaginatedSeriesGrid.tsx @@ -4,8 +4,6 @@ import { SeriesGrid } from "./SeriesGrid"; import { Pagination } from "@/components/ui/Pagination"; import { useRouter, usePathname, useSearchParams } from "next/navigation"; import { useState, useEffect, useCallback } from "react"; -import { Loader2 } from "lucide-react"; -import { cn } from "@/lib/utils"; import type { KomgaSeries } from "@/types/komga"; import { SearchInput } from "./SearchInput"; import { useTranslate } from "@/hooks/useTranslate"; @@ -34,7 +32,6 @@ export function PaginatedSeriesGrid({ const router = useRouter(); const pathname = usePathname(); const searchParams = useSearchParams(); - const [isChangingPage, setIsChangingPage] = useState(false); const [showOnlyUnread, setShowOnlyUnread] = useState(initialShowOnlyUnread); const { isCompact, itemsPerPage: _itemsPerPage } = useDisplayPreferences(); const { t } = useTranslate(); @@ -43,7 +40,6 @@ export function PaginatedSeriesGrid({ updates: Record, replace: boolean = false ) => { - setIsChangingPage(true); const params = new URLSearchParams(searchParams.toString()); Object.entries(updates).forEach(([key, value]) => { @@ -61,11 +57,6 @@ export function PaginatedSeriesGrid({ } }, [router, pathname, searchParams]); - // Reset loading state when series change - useEffect(() => { - setIsChangingPage(false); - }, [series]); - // Update local state when prop changes useEffect(() => { setShowOnlyUnread(initialShowOnlyUnread); @@ -120,27 +111,7 @@ export function PaginatedSeriesGrid({ -
- {/* Loading indicator */} - {isChangingPage && ( -
-
- - {t("sidebar.libraries.loading")} -
-
- )} - - {/* Grid with transition animation */} -
- -
-
+

diff --git a/src/components/series/PaginatedBookGrid.tsx b/src/components/series/PaginatedBookGrid.tsx index fc08e54..da2679b 100644 --- a/src/components/series/PaginatedBookGrid.tsx +++ b/src/components/series/PaginatedBookGrid.tsx @@ -4,8 +4,6 @@ import { BookGrid } from "./BookGrid"; import { Pagination } from "@/components/ui/Pagination"; import { useRouter, usePathname, useSearchParams } from "next/navigation"; import { useState, useEffect, useCallback } from "react"; -import { Loader2 } from "lucide-react"; -import { cn } from "@/lib/utils"; import type { KomgaBook } from "@/types/komga"; import { useTranslate } from "@/hooks/useTranslate"; import { useDisplayPreferences } from "@/hooks/useDisplayPreferences"; @@ -33,7 +31,6 @@ export function PaginatedBookGrid({ const router = useRouter(); const pathname = usePathname(); const searchParams = useSearchParams(); - const [isChangingPage, setIsChangingPage] = useState(false); const [showOnlyUnread, setShowOnlyUnread] = useState(initialShowOnlyUnread); const { isCompact, itemsPerPage } = useDisplayPreferences(); const { t } = useTranslate(); @@ -42,7 +39,6 @@ export function PaginatedBookGrid({ updates: Record, replace: boolean = false ) => { - setIsChangingPage(true); const params = new URLSearchParams(searchParams.toString()); Object.entries(updates).forEach(([key, value]) => { @@ -60,11 +56,6 @@ export function PaginatedBookGrid({ } }, [router, pathname, searchParams]); - // Reset loading state when books change - useEffect(() => { - setIsChangingPage(false); - }, [books]); - // Update local state when prop changes useEffect(() => { setShowOnlyUnread(initialShowOnlyUnread); @@ -133,27 +124,7 @@ export function PaginatedBookGrid({

-
- {/* Loading indicator */} - {isChangingPage && ( -
-
- - {t("books.loading")} -
-
- )} - - {/* Grid with transition animation */} -
- -
-
+