From a5ebc6d1ae2e74c728ce01f06175980e6a94def0 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Thu, 5 Mar 2026 14:17:42 +0700 Subject: [PATCH] refactor(FE): Fix dependency arrays and improve error handling in purchase components --- .../pages/purchase/order/PurchaseOrderDetail.tsx | 8 +++++--- .../pages/purchase/order/PurchaseOrderInvoice.tsx | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/pages/purchase/order/PurchaseOrderDetail.tsx b/src/components/pages/purchase/order/PurchaseOrderDetail.tsx index f5899e36..6706039c 100644 --- a/src/components/pages/purchase/order/PurchaseOrderDetail.tsx +++ b/src/components/pages/purchase/order/PurchaseOrderDetail.tsx @@ -351,13 +351,13 @@ const PurchaseOrderDetail = ({ refreshApprovals(); refetchData?.(); staffApprovalModal.closeModal(); - }, [refreshApprovals, refetchData]); + }, [refreshApprovals, refetchData, staffApprovalModal]); const handleEditModalClose = useCallback(() => { refreshApprovals(); refetchData?.(); editModal.closeModal(); - }, [refreshApprovals, refetchData]); + }, [refreshApprovals, refetchData, editModal]); // ===== DELETE HANDLER ===== const deleteItemsHandler = useCallback(async () => { @@ -399,7 +399,7 @@ const PurchaseOrderDetail = ({ deleteModal.closeModal(); setSelectedItem(null); setRowSelection({}); - } catch (error) { + } catch { toast.error('Terjadi kesalahan saat menghapus item pembelian'); } finally { setIsDeleteLoading(false); @@ -410,6 +410,8 @@ const PurchaseOrderDetail = ({ selectedItem, selectedRowIds, refetchData, + refreshApprovals, + deleteModal, ]); // ===== APPROVAL/REJECTION HANDLERS ===== diff --git a/src/components/pages/purchase/order/PurchaseOrderInvoice.tsx b/src/components/pages/purchase/order/PurchaseOrderInvoice.tsx index aed154d0..c87b65bc 100644 --- a/src/components/pages/purchase/order/PurchaseOrderInvoice.tsx +++ b/src/components/pages/purchase/order/PurchaseOrderInvoice.tsx @@ -263,6 +263,7 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => { {/* Header Section */} + {/* eslint-disable-next-line jsx-a11y/alt-text */}