diff --git a/src/components/pages/report/logistic-stock/PurchasesPerSupplierTab.tsx b/src/components/pages/report/logistic-stock/PurchasesPerSupplierTab.tsx index f0f9f64e..8a3879a5 100644 --- a/src/components/pages/report/logistic-stock/PurchasesPerSupplierTab.tsx +++ b/src/components/pages/report/logistic-stock/PurchasesPerSupplierTab.tsx @@ -154,23 +154,35 @@ const PurchasesPerSupplierTab = () => { // ===== DATA FETCHING ===== const { data: purchasePerSupplier, isLoading } = useSWR( - () => - LogisticApi.getLogisticStockReport( - tableFilterState.area_id ? Number(tableFilterState.area_id) : undefined, - tableFilterState.supplier_id + () => { + const params = { + area_id: tableFilterState.area_id + ? Number(tableFilterState.area_id) + : undefined, + supplier_id: tableFilterState.supplier_id ? Number(tableFilterState.supplier_id) : undefined, - tableFilterState.product_id + product_id: tableFilterState.product_id ? Number(tableFilterState.product_id) : undefined, - tableFilterState.received_date || undefined, - tableFilterState.po_date || undefined, - tableFilterState.start_date || undefined, - tableFilterState.end_date || undefined - ), - { - revalidateOnFocus: false, - } + received_date: tableFilterState.received_date || undefined, + po_date: tableFilterState.po_date || undefined, + start_date: tableFilterState.start_date || undefined, + end_date: tableFilterState.end_date || undefined, + }; + + return ['logistic-purchase-report', params]; + }, + ([, params]) => + LogisticApi.getLogisticStockReport( + params.area_id, + params.supplier_id, + params.product_id, + params.received_date, + params.po_date, + params.start_date, + params.end_date + ) ); const data: LogisticPurchasePerSupplier[] = isResponseSuccess(