fix: filter on bookgrid ko
This commit is contained in:
@@ -4,7 +4,7 @@ import { KomgaBook } from "@/types/komga";
|
|||||||
import { formatDate } from "@/lib/utils";
|
import { formatDate } from "@/lib/utils";
|
||||||
import { Cover } from "@/components/ui/cover";
|
import { Cover } from "@/components/ui/cover";
|
||||||
import { MarkAsReadButton } from "@/components/ui/mark-as-read-button";
|
import { MarkAsReadButton } from "@/components/ui/mark-as-read-button";
|
||||||
import { useState } from "react";
|
import { useState, useEffect } from "react";
|
||||||
|
|
||||||
interface BookGridProps {
|
interface BookGridProps {
|
||||||
books: KomgaBook[];
|
books: KomgaBook[];
|
||||||
@@ -44,6 +44,11 @@ const getReadingStatusInfo = (book: KomgaBook) => {
|
|||||||
export function BookGrid({ books, onBookClick }: BookGridProps) {
|
export function BookGrid({ books, onBookClick }: BookGridProps) {
|
||||||
const [localBooks, setLocalBooks] = useState(books);
|
const [localBooks, setLocalBooks] = useState(books);
|
||||||
|
|
||||||
|
// Synchroniser localBooks avec les props books
|
||||||
|
useEffect(() => {
|
||||||
|
setLocalBooks(books);
|
||||||
|
}, [books]);
|
||||||
|
|
||||||
if (!localBooks.length) {
|
if (!localBooks.length) {
|
||||||
return (
|
return (
|
||||||
<div className="text-center p-8">
|
<div className="text-center p-8">
|
||||||
|
|||||||
Reference in New Issue
Block a user