From aad1a7b4473c1cd7fa7611ee1064f5ce1bed884d Mon Sep 17 00:00:00 2001 From: dohyeons Date: Wed, 1 Oct 2025 11:47:40 +0900 Subject: [PATCH] =?UTF-8?q?useReportList=20=EC=83=81=ED=98=B8=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/hooks/useReportList.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/hooks/useReportList.ts b/frontend/hooks/useReportList.ts index e266f17d..8c99c409 100644 --- a/frontend/hooks/useReportList.ts +++ b/frontend/hooks/useReportList.ts @@ -1,4 +1,4 @@ -import { useState, useEffect, useCallback } from "react"; +import { useState, useEffect } from "react"; import { ReportMaster, GetReportsParams } from "@/types/report"; import { reportApi } from "@/lib/api/reportApi"; import { useToast } from "@/hooks/use-toast"; @@ -12,7 +12,7 @@ export function useReportList() { const [searchText, setSearchText] = useState(""); const { toast } = useToast(); - const fetchReports = useCallback(async () => { + const fetchReports = async () => { setIsLoading(true); try { const params: GetReportsParams = { @@ -31,6 +31,7 @@ export function useReportList() { setTotal(response.data.total); } } catch (error: any) { + console.error("리포트 목록 조회 에러:", error); toast({ title: "오류", description: error.message || "리포트 목록을 불러오는데 실패했습니다.", @@ -39,16 +40,17 @@ export function useReportList() { } finally { setIsLoading(false); } - }, [page, limit, searchText, toast]); + }; useEffect(() => { fetchReports(); - }, [fetchReports]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [page, searchText]); - const handleSearch = useCallback((text: string) => { + const handleSearch = (text: string) => { setSearchText(text); setPage(1); - }, []); + }; return { reports,