refactor: make library rendering server-first and deterministic
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m7s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m7s
Move library header/covers to deterministic server-side rendering, split preference controls into controlled/uncontrolled modes, and remove client cover wrapper to eliminate hydration mismatches and provider coupling on library pages.
This commit is contained in:
@@ -19,7 +19,7 @@ export async function updateReadProgress(
|
||||
await BookService.updateReadProgress(bookId, page, completed);
|
||||
|
||||
// Invalider le cache de la home (sans refresh auto)
|
||||
revalidateTag(HOME_CACHE_TAG, "min");
|
||||
revalidateTag(HOME_CACHE_TAG, "max");
|
||||
|
||||
return { success: true, message: "Progression mise à jour" };
|
||||
} catch (error) {
|
||||
@@ -40,7 +40,7 @@ export async function deleteReadProgress(
|
||||
await BookService.deleteReadProgress(bookId);
|
||||
|
||||
// Invalider le cache de la home (sans refresh auto)
|
||||
revalidateTag(HOME_CACHE_TAG, "min");
|
||||
revalidateTag(HOME_CACHE_TAG, "max");
|
||||
|
||||
return { success: true, message: "Progression supprimée" };
|
||||
} catch (error) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useState, type ReactNode } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { PullToRefreshIndicator } from "@/components/common/PullToRefreshIndicator";
|
||||
import { usePullToRefresh } from "@/hooks/usePullToRefresh";
|
||||
import { RefreshProvider } from "@/contexts/RefreshContext";
|
||||
|
||||
interface LibraryClientWrapperProps {
|
||||
children: ReactNode;
|
||||
@@ -42,7 +41,7 @@ export function LibraryClientWrapper({ children }: LibraryClientWrapperProps) {
|
||||
canRefresh={pullToRefresh.canRefresh}
|
||||
isHiding={pullToRefresh.isHiding}
|
||||
/>
|
||||
<RefreshProvider refreshLibrary={handleRefresh}>{children}</RefreshProvider>
|
||||
{children}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { LibraryHeader } from "@/components/library/LibraryHeader";
|
||||
import { PaginatedSeriesGrid } from "@/components/library/PaginatedSeriesGrid";
|
||||
import { Container } from "@/components/ui/container";
|
||||
import { useRefresh } from "@/contexts/RefreshContext";
|
||||
import type { KomgaLibrary } from "@/types/komga";
|
||||
import type { LibraryResponse } from "@/types/library";
|
||||
import type { Series } from "@/types/series";
|
||||
@@ -27,15 +24,12 @@ export function LibraryContent({
|
||||
unreadOnly,
|
||||
pageSize,
|
||||
}: LibraryContentProps) {
|
||||
const { refreshLibrary } = useRefresh();
|
||||
|
||||
return (
|
||||
<>
|
||||
<LibraryHeader
|
||||
library={library}
|
||||
seriesCount={series.totalElements}
|
||||
series={series.content || []}
|
||||
refreshLibrary={refreshLibrary || (async () => ({ success: false }))}
|
||||
/>
|
||||
<Container>
|
||||
<PaginatedSeriesGrid
|
||||
@@ -46,6 +40,8 @@ export function LibraryContent({
|
||||
defaultShowOnlyUnread={preferences.showOnlyUnread}
|
||||
showOnlyUnread={unreadOnly}
|
||||
pageSize={pageSize}
|
||||
initialCompact={preferences.displayMode.compact}
|
||||
initialViewMode={preferences.displayMode.viewMode || "grid"}
|
||||
/>
|
||||
</Container>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user