fix page change when fetching
This commit is contained in:
parent
44d46a51cd
commit
2552696aca
@ -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 =>
|
||||
|
Loading…
Reference in New Issue
Block a user