diff --git a/src/components/admin/admin-table/admin-table.tsx b/src/components/admin/admin-table/admin-table.tsx index ea4e7d2..528d784 100644 --- a/src/components/admin/admin-table/admin-table.tsx +++ b/src/components/admin/admin-table/admin-table.tsx @@ -104,15 +104,18 @@ export default function AdminTable() { .then((reimbursements) => { setReimbursements(reimbursements); setIsLoading(false); - handleWindowResize(); }) .catch((err) => { setError(err); setIsLoading(false); }); + }, []); + + React.useEffect(() => { + handleWindowResize(); window.addEventListener("resize", handleWindowResize); return () => window.removeEventListener("resize", handleWindowResize); - }, []); + }, [reimbursements]); const table = useReactTable({ data: reimbursements, diff --git a/src/components/sponsored-org/sponsored-org-table/data-table.tsx b/src/components/sponsored-org/sponsored-org-table/data-table.tsx index f019c2d..df40dbd 100644 --- a/src/components/sponsored-org/sponsored-org-table/data-table.tsx +++ b/src/components/sponsored-org/sponsored-org-table/data-table.tsx @@ -64,7 +64,7 @@ export function DataTable({ columns, data }: DataTableProps window.removeEventListener("resize", handleWindowResize); - }, []); + }, [data]); const table = useReactTable({ data,