From 61e3578ea4879b8546a11020251f35e9749cee14 Mon Sep 17 00:00:00 2001 From: r41ph Date: Wed, 9 Oct 2024 17:29:28 +0100 Subject: [PATCH] fix: pagination issue in getSellOrdersExtendedQuery --- .../getSellOrdersExtendedQuery.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web-marketplace/src/lib/queries/react-query/ecocredit/marketplace/getSellOrdersExtendedQuery/getSellOrdersExtendedQuery.ts b/web-marketplace/src/lib/queries/react-query/ecocredit/marketplace/getSellOrdersExtendedQuery/getSellOrdersExtendedQuery.ts index 7fc50cfd1f..dbc3ec1f6f 100644 --- a/web-marketplace/src/lib/queries/react-query/ecocredit/marketplace/getSellOrdersExtendedQuery/getSellOrdersExtendedQuery.ts +++ b/web-marketplace/src/lib/queries/react-query/ecocredit/marketplace/getSellOrdersExtendedQuery/getSellOrdersExtendedQuery.ts @@ -29,16 +29,16 @@ export const getSellOrdersExtendedQuery = ({ queryKey: [SELL_ORDERS_EXTENTED_KEY], queryFn: async () => { if (!client) return undefined; - + let _request = { ...request }; // Fetching all sell orders // TODO this could potentially be improved with pagination for the storefront page let sellOrders: SellOrderInfo[] = []; let response: QuerySellOrdersResponse | undefined; while (!response || response.pagination?.nextKey?.length) { if (response?.pagination?.nextKey?.length) { - request.pagination = { key: response.pagination.nextKey }; + _request.pagination = { key: response.pagination.nextKey }; } - response = await client.SellOrders(request); + response = await client.SellOrders(_request); sellOrders.push(...response.sellOrders); }