Explorar el Código

Merge pull request #1721 from porter-dev/nico/fix-range-error-on-table-component

[fix] Fix Range error on table component
Nicolas Frati hace 4 años
padre
commit
77dda4d32a
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      dashboard/src/components/Table.tsx

+ 3 - 1
dashboard/src/components/Table.tsx

@@ -41,6 +41,8 @@ export type TableProps = {
   enablePagination?: boolean;
 };
 
+const MIN_PAGE_SIZE = 1;
+
 const Table: React.FC<TableProps> = ({
   columns: columnsData,
   data,
@@ -80,7 +82,7 @@ const Table: React.FC<TableProps> = ({
 
   useEffect(() => {
     if (!enablePagination) {
-      setPageSize(data.length);
+      setPageSize(data.length || MIN_PAGE_SIZE);
     }
   }, [data, enablePagination]);