From caac1d297b300016479621dc21025a6ed65702be Mon Sep 17 00:00:00 2001 From: ameerul-deriv Date: Wed, 24 Apr 2024 17:46:44 +0800 Subject: [PATCH] fix: useOrderList --- src/hooks/api/order/p2p-order/useOrderList.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/hooks/api/order/p2p-order/useOrderList.ts b/src/hooks/api/order/p2p-order/useOrderList.ts index 6a4306cd..8fb09f2f 100644 --- a/src/hooks/api/order/p2p-order/useOrderList.ts +++ b/src/hooks/api/order/p2p-order/useOrderList.ts @@ -3,19 +3,13 @@ import { useInfiniteQuery, useP2POrderList } from '@deriv-com/api-hooks'; /** This custom hook returns a list of orders under the current client. */ const useOrderList = ( - payload?: NonNullable>[1]>['payload'], - config?: NonNullable>[1]>['options'] + payload?: NonNullable>[0]>['payload'], + isEnabled = true ) => { // Fetch the order list data which handles pagination - const { data, subscriptionData, ...rest } = useP2POrderList({ + const { data, ...rest } = useP2POrderList({ payload: { ...payload, offset: payload?.offset, limit: payload?.limit }, - options: { - getNextPageParam: (lastPage, pages) => { - if (lastPage?.p2p_order_list?.list?.length === 0) return; - return pages.length; - }, - enabled: subscriptionData && (config?.enabled === undefined || config.enabled), - }, + enabled: isEnabled, }); // Additional p2p_order_list data