From 2552696acabac1eb4c374294edff60c3b6b02a19 Mon Sep 17 00:00:00 2001 From: nflnkr Date: Thu, 23 Mar 2023 14:40:19 +0300 Subject: [PATCH] fix page change when fetching --- src/pages/dashboard/Content/Support/TicketList.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/dashboard/Content/Support/TicketList.tsx b/src/pages/dashboard/Content/Support/TicketList.tsx index e20f5c2..e968d60 100644 --- a/src/pages/dashboard/Content/Support/TicketList.tsx +++ b/src/pages/dashboard/Content/Support/TicketList.tsx @@ -81,7 +81,7 @@ export default function TicketList() { const scrollBottom = ticketsBox.scrollHeight - ticketsBox.scrollTop - ticketsBox.clientHeight; if ( scrollBottom < ticketsBox.scrollHeight * 0.5 && - isFetchingTicketsRef.current !== "all fetched" + isFetchingTicketsRef.current === "idle" ) setCurrentPage(prev => prev + 1); }; @@ -93,6 +93,10 @@ export default function TicketList() { }; }, []); + useEffect(() => { + console.log("currentPage:", currentPage); + }, [currentPage]); + const sortedTickets = tickets.sort(sortTicketsByUpdateTime).sort(sortTicketsByUnread); return ( @@ -156,6 +160,7 @@ export default function TicketList() { overflow: "auto", overflowY: "auto", padding: "10px", + height: "100px", }} > {sortedTickets.map(ticket =>