fix: lint on reader
This commit is contained in:
@@ -32,6 +32,7 @@ export function BookReader({ book, pages, onClose }: BookReaderProps) {
|
|||||||
book,
|
book,
|
||||||
pages,
|
pages,
|
||||||
isDoublePage,
|
isDoublePage,
|
||||||
|
onClose,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { preloadPage, getPageUrl, cleanCache } = usePageCache({
|
const { preloadPage, getPageUrl, cleanCache } = usePageCache({
|
||||||
@@ -81,7 +82,15 @@ export function BookReader({ book, pages, onClose }: BookReaderProps) {
|
|||||||
return () => {
|
return () => {
|
||||||
isMounted = false;
|
isMounted = false;
|
||||||
};
|
};
|
||||||
}, [currentPage, isDoublePage, shouldShowDoublePage, getPageUrl]);
|
}, [
|
||||||
|
currentPage,
|
||||||
|
isDoublePage,
|
||||||
|
shouldShowDoublePage,
|
||||||
|
getPageUrl,
|
||||||
|
setIsLoading,
|
||||||
|
setSecondPageLoading,
|
||||||
|
setImageError,
|
||||||
|
]);
|
||||||
|
|
||||||
// Effet pour précharger la page courante et les pages adjacentes
|
// Effet pour précharger la page courante et les pages adjacentes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -137,7 +146,7 @@ export function BookReader({ book, pages, onClose }: BookReaderProps) {
|
|||||||
setSecondPageLoading(false);
|
setSecondPageLoading(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[currentPage]
|
[currentPage, setIsLoading, setSecondPageLoading]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ interface UsePageNavigationProps {
|
|||||||
book: KomgaBook;
|
book: KomgaBook;
|
||||||
pages: number[];
|
pages: number[];
|
||||||
isDoublePage: boolean;
|
isDoublePage: boolean;
|
||||||
onClose: () => void;
|
onClose?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const usePageNavigation = ({
|
export const usePageNavigation = ({
|
||||||
book,
|
book,
|
||||||
pages,
|
pages,
|
||||||
isDoublePage,
|
isDoublePage,
|
||||||
onClose,
|
onClose = () => {},
|
||||||
}: UsePageNavigationProps) => {
|
}: UsePageNavigationProps) => {
|
||||||
const [currentPage, setCurrentPage] = useState(book.readProgress?.page || 1);
|
const [currentPage, setCurrentPage] = useState(book.readProgress?.page || 1);
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user