Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(ui): table pagination distinguish between no data and loading states (#3851)

marliessophie187e64c8d2d7
diff --git a/web/src/components/table/data-table-pagination.tsx b/web/src/components/table/data-table-pagination.tsx
index 88fb228f66..f3dff76bc4 100644
--- a/web/src/components/table/data-table-pagination.tsx
+++ b/web/src/components/table/data-table-pagination.tsx
@@ -21,11 +21,13 @@ import { useEffect, useState } from "react";
interface DataTablePaginationProps<TData> {
table: Table<TData>;
+ isLoading: boolean;
paginationOptions?: number[];
}
export function DataTablePagination<TData>({
table,
+ isLoading,
paginationOptions = [10, 20, 30, 40, 50],
}: DataTablePaginationProps<TData>) {
const capture = usePostHogClientCapture();
@@ -129,7 +131,11 @@ export function DataTablePagination<TData>({
) : (
<span>
of{" "}
- <LoaderCircle className="ml-1 inline-block h-3 w-3 animate-spin text-muted-foreground" />
+ {isLoading ? (
+ <LoaderCircle className="ml-1 inline-block h-3 w-3 animate-spin text-muted-foreground" />
+ ) : (
+ 1
+ )}
</span>
)}
</div>
@@ -172,7 +178,7 @@ export function DataTablePagination<TData>({
type: "nextPage",
});
}}
- disabled={!table.getCanNextPage()}
+ disabled={!table.getCanNextPage() || pageCount === -1}
>
<span className="sr-only">Go to next page</span>
<ChevronRightIcon className="h-4 w-4" />
diff --git a/web/src/components/table/data-table.tsx b/web/src/components/table/data-table.tsx
index 3eff7733d5..3c28503690 100644
--- a/web/src/components/table/data-table.tsx
+++ b/web/src/components/table/data-table.tsx
@@ -342,6 +342,7 @@ export function DataTable<TData extends object, TValue>({
>
<DataTablePagination
table={table}
+ isLoading={data.isLoading}
paginationOptions={pagination.options}
/>
</div>