diff --git a/next/web/src/App/Admin/Tickets/Ticket/timeline-data.ts b/next/web/src/App/Admin/Tickets/Ticket/timeline-data.ts index e30b00b1e..73dc6fa56 100644 --- a/next/web/src/App/Admin/Tickets/Ticket/timeline-data.ts +++ b/next/web/src/App/Admin/Tickets/Ticket/timeline-data.ts @@ -14,6 +14,7 @@ export function useTicketReplies(ticketId?: string) { return fetchTicketReplies(ticketId || '', { cursor: pageParam, deleted: true, + pageSize: 1000, }); }, enabled: !!ticketId, @@ -74,7 +75,12 @@ export function useTicketReplies(ticketId?: string) { export function useTicketOpsLogs(ticketId?: string) { const { data, fetchNextPage, refetch } = useInfiniteQuery({ queryKey: ['TicketOpsLogs', ticketId], - queryFn: ({ pageParam }) => fetchTicketOpsLogs(ticketId || '', pageParam), + queryFn: ({ pageParam }) => { + return fetchTicketOpsLogs(ticketId || '', { + cursor: pageParam, + pageSize: 1000, + }); + }, enabled: !!ticketId, getNextPageParam: (lastPage) => last(lastPage)?.createdAt, }); diff --git a/next/web/src/api/ticket.ts b/next/web/src/api/ticket.ts index 8cfe6f39e..6b3d5ea4d 100644 --- a/next/web/src/api/ticket.ts +++ b/next/web/src/api/ticket.ts @@ -174,16 +174,18 @@ async function fetchTicket( interface FetchTicketRepliesOptions { cursor?: string; deleted?: boolean; + pageSize?: number; } export async function fetchTicketReplies( id: string, - { cursor, deleted }: FetchTicketRepliesOptions = {} + { cursor, deleted, pageSize }: FetchTicketRepliesOptions = {} ): Promise { const { data } = await http.get(`/api/2/tickets/${id}/replies`, { params: { cursor, deleted: deleted ? 1 : undefined, + pageSize, }, }); return data; @@ -463,10 +465,19 @@ export type OpsLog = BaseOpsLog & } ); -export async function fetchTicketOpsLogs(ticketId: string, cursor?: string) { +interface FetchOpsLogsOptions { + cursor?: string; + pageSize?: number; +} + +export async function fetchTicketOpsLogs( + ticketId: string, + { cursor, pageSize }: FetchOpsLogsOptions = {} +) { const res = await http.get(`/api/2/tickets/${ticketId}/ops-logs`, { params: { cursor, + pageSize, }, }); return res.data;