diff --git a/client/src/pages/home/index.tsx b/client/src/pages/home/index.tsx index 9136dfa..e33891b 100644 --- a/client/src/pages/home/index.tsx +++ b/client/src/pages/home/index.tsx @@ -33,7 +33,7 @@ export const Home: React.FC = () => { // Fetch all spools (not archived) for the main list const { result: spoolsResult, query: spoolsQuery } = useList({ resource: "spool", - pagination: { current: currentPage, pageSize }, + pagination: { currentPage, pageSize }, sorters: [{ field: "last_used", order: "desc" }], meta: { queryParams: { @@ -54,9 +54,9 @@ export const Home: React.FC = () => { // Calculate low stock spools const lowStockCount = useMemo(() => { - if (!spoolsResult?.data) return 0; - return spoolsResult.data.filter( - (spool: ISpool) => spool.remaining_weight !== undefined && spool.remaining_weight < LOW_STOCK_THRESHOLD + const data = spoolsResult?.data || []; + return data.filter( + (spool) => spool.remaining_weight !== undefined && spool.remaining_weight < LOW_STOCK_THRESHOLD ).length; }, [spoolsResult?.data]); @@ -191,8 +191,8 @@ export const Home: React.FC = () => { extra={{t("buttons.viewAll")}} styles={{ body: { padding: 0 } }} > - + dataSource={spoolsResult?.data as ISpool[]} columns={spoolColumns} rowKey="id" loading={spoolsQuery.isLoading}