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;
|
const scrollBottom = ticketsBox.scrollHeight - ticketsBox.scrollTop - ticketsBox.clientHeight;
|
||||||
if (
|
if (
|
||||||
scrollBottom < ticketsBox.scrollHeight * 0.5 &&
|
scrollBottom < ticketsBox.scrollHeight * 0.5 &&
|
||||||
isFetchingTicketsRef.current !== "all fetched"
|
isFetchingTicketsRef.current === "idle"
|
||||||
) setCurrentPage(prev => prev + 1);
|
) 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);
|
const sortedTickets = tickets.sort(sortTicketsByUpdateTime).sort(sortTicketsByUnread);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -156,6 +160,7 @@ export default function TicketList() {
|
|||||||
overflow: "auto",
|
overflow: "auto",
|
||||||
overflowY: "auto",
|
overflowY: "auto",
|
||||||
padding: "10px",
|
padding: "10px",
|
||||||
|
height: "100px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{sortedTickets.map(ticket =>
|
{sortedTickets.map(ticket =>
|
||||||
|
Loading…
Reference in New Issue
Block a user