Skip to content

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

fix(web): Improve skeleton loading state for tables (#13235)

Ben Bachemf993eb1efc5d
diff --git a/web/src/components/table/data-table.tsx b/web/src/components/table/data-table.tsx
index 8c0beca3a7..063f724171 100644
--- a/web/src/components/table/data-table.tsx
+++ b/web/src/components/table/data-table.tsx
@@ -13,6 +13,7 @@ import {
type RowHeight,
getRowHeightTailwindClass,
} from "@/src/components/table/data-table-row-height-switch";
+import { TableTextLoadingCell } from "@/src/components/table/loading-cells";
import { type LangfuseColumnDef } from "@/src/components/table/types";
import { type ModelTableRow } from "@/src/components/table/use-cases/models";
import {
@@ -540,17 +541,71 @@ function TableBodyComponent<TData>({
topAlignCells = false,
cellPadding = "compact",
}: TableBodyComponentProps<TData>) {
+ const visibleColumns = table.getVisibleLeafColumns();
+ const skeletonRowCount = Math.max(
+ 1,
+ Math.min(table.getState().pagination?.pageSize ?? 8, 8),
+ );
+
return (
<TableBody>
{data.isLoading || !data.data ? (
- <TableRow className="h-svh">
- <TableCell
- colSpan={columns.length}
- className="content-start border-b text-center"
- >
- Loading...
- </TableCell>
- </TableRow>
+ Array.from({ length: skeletonRowCount }).map((_, rowIndex) => (
+ <TableRow key={`loading-row-${rowIndex}`} aria-hidden="true">
+ {visibleColumns.map((column, columnIndex) => (
+ <TableCell
+ key={`${column.id}-loading-cell-${rowIndex}`}
+ className={cn(
+ "overflow-hidden border-b text-xs first:pl-2",
+ cellPadding === "comfortable" ? "p-1" : "px-1",
+ (rowHeight ?? "s") === "s" && "whitespace-nowrap",
+ getPinningClasses(column),
+ )}
+ style={{
+ width: `calc(var(--col-${column.id}-size) * 1px)`,
+ ...getCommonPinningStyles(column),
+ }}
+ >
+ <div
+ className={cn(
+ "flex",
+ (rowHeight ?? "s") === "s" && !topAlignCells
+ ? "items-center"
+ : "items-start",
+ (rowHeight ?? "s") !== "s" && "py-1",
+ rowheighttw,
+ )}
+ >
+ {(() => {
+ const columnDef =
+ column.columnDef as LangfuseColumnDef<TData>;
+ const loadingCell = columnDef.loadingCell;
+
+ if (typeof loadingCell === "function") {
+ return loadingCell();
+ }
+
+ if (loadingCell !== undefined) {
+ return loadingCell;
+ }
+
+ return (
+ <TableTextLoadingCell
+ className={cn(
+ "min-w-[3rem]",
+ (rowIndex + columnIndex) % 4 === 0 && "w-3/4",
+ (rowIndex + columnIndex) % 4 === 1 && "w-1/2",
+ (rowIndex + columnIndex) % 4 === 2 && "w-2/3",
+ (rowIndex + columnIndex) % 4 === 3 && "w-5/6",
+ )}
+ />
+ );
+ })()}
+ </div>
+ </TableCell>
+ ))}
+ </TableRow>
+ ))
) : table.getRowModel().rows.length ? (
table.getRowModel().rows.map((row) => (
<TableRowComponent
diff --git a/web/src/components/table/loading-cells.tsx b/web/src/components/table/loading-cells.tsx
new file mode 100644
index 0000000000..12c83ab8ef
--- /dev/null
+++ b/web/src/components/table/loading-cells.tsx
@@ -0,0 +1,44 @@
+import { Skeleton } from "@/src/components/ui/skeleton";
+import { cn } from "@/src/utils/tailwind";
+
+export function TableCheckboxLoadingCell({
+ className,
+}: {
+ className?: string;
+}) {
+ return <Skeleton className={cn("h-4 w-4 shrink-0 rounded-sm", className)} />;
+}
+
+export function TableIconButtonLoadingCell({
+ className,
+ size = "xs",
+}: {
+ className?: string;
+ size?: "xs" | "default";
+}) {
+ return (
+ <Skeleton
+ className={cn(
+ "shrink-0 rounded-full",
+ size === "xs" ? "h-5 w-5" : "h-7 w-7",
+ className,
+ )}
+ />
+ );
+}
+
+export function TableIconBadgeLoadingCell({
+ className,
+}: {
+ className?: string;
+}) {
+ return <Skeleton className={cn("h-5 w-6 shrink-0 rounded-md", className)} />;
+}
+
+export function TableBadgeLoadingCell({ className }: { className?: string }) {
+ return <Skeleton className={cn("h-5 w-16 shrink-0 rounded-sm", className)} />;
+}
+
+export function TableTextLoadingCell({ className }: { className?: string }) {
+ return <Skeleton className={cn("h-4 w-1/2", className)} />;
+}
diff --git a/web/src/components/table/types.ts b/web/src/components/table/types.ts
index ada3c2234e..89f73e47db 100644
--- a/web/src/components/table/types.ts
+++ b/web/src/components/table/types.ts
@@ -18,6 +18,7 @@ type ExtendedColumnDef<TData extends RowData, TValue = unknown> = ColumnDef<
};
isFixedPosition?: boolean; // if true, column cannot be reordered
isPinnedLeft?: boolean; // if true, column will be pinned to left side
+ loadingCell?: React.ReactNode | (() => React.ReactNode);
};
// limits types of defined tanstack ColumnDef properties to specific subset of tanstack type union
diff --git a/web/src/components/table/use-cases/observations.tsx b/web/src/components/table/use-cases/observations.tsx
index c78546ffbe..e02bcff494 100644
--- a/web/src/components/table/use-cases/observations.tsx
+++ b/web/src/components/table/use-cases/observations.tsx
@@ -23,6 +23,11 @@ import { DEFAULT_SIDEBAR_IMPLICIT_ENVIRONMENT_CONFIG } from "@/src/features/filt
import { transformFiltersForBackend } from "@/src/features/filters/lib/filter-transform";
import { formatIntervalSeconds } from "@/src/utils/dates";
import useColumnVisibility from "@/src/features/column-visibility/hooks/useColumnVisibility";
+import {
+ TableBadgeLoadingCell,
+ TableIconBadgeLoadingCell,
+ TableTextLoadingCell,
+} from "@/src/components/table/loading-cells";
import { type LangfuseColumnDef } from "@/src/components/table/types";
import {
type ObservationLevelType,
@@ -62,7 +67,6 @@ import { Badge } from "@/src/components/ui/badge";
import { type RowSelectionState, type Row } from "@tanstack/react-table";
import TableIdOrName from "@/src/components/table/table-id";
import { ItemBadge } from "@/src/components/ItemBadge";
-import { Skeleton } from "@/src/components/ui/skeleton";
import { PeekViewObservationDetail } from "@/src/components/table/peek/peek-observation-detail";
import { usePeekNavigation } from "@/src/components/table/peek/hooks/usePeekNavigation";
import { useDetailPageLists } from "@/src/features/navigate-detail-pages/context";
@@ -653,6 +657,7 @@ export default function ObservationsTable({
id: "type",
header: "Type",
size: 50,
+ loadingCell: <TableIconBadgeLoadingCell />,
enableSorting,
cell: ({ row }) => {
const value: ObservationType = row.getValue("type");
@@ -679,6 +684,14 @@ export default function ObservationsTable({
header: "Input",
id: "input",
size: 300,
+ loadingCell: () => (
+ <MemoizedIOTableCell
+ isLoading
+ data={undefined}
+ className="bg-muted/50"
+ singleLine={rowHeight === "s"}
+ />
+ ),
cell: ({ row }) => {
const observationId: string = row.getValue("id");
const traceId: string = row.getValue("traceId");
@@ -700,6 +713,14 @@ export default function ObservationsTable({
id: "output",
header: "Output",
size: 300,
+ loadingCell: () => (
+ <MemoizedIOTableCell
+ isLoading
+ data={undefined}
+ className="bg-accent-light-green"
+ singleLine={rowHeight === "s"}
+ />
+ ),
cell: ({ row }) => {
const observationId: string = row.getValue("id");
const traceId: string = row.getValue("traceId");
@@ -939,6 +960,7 @@ export default function ObservationsTable({
id: "environment",
size: 150,
enableHiding: true,
+ loadingCell: <TableBadgeLoadingCell />,
cell: ({ row }) => {
const value: ObservationsTableRow["environment"] =
row.getValue("environment");
@@ -958,6 +980,7 @@ export default function ObservationsTable({
header: "Trace Tags",
size: 250,
enableHiding: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const traceTags: string[] | undefined = row.getValue("traceTags");
return (
@@ -978,6 +1001,13 @@ export default function ObservationsTable({
accessorKey: "metadata",
header: "Metadata",
size: 300,
+ loadingCell: () => (
+ <MemoizedIOTableCell
+ isLoading
+ data={undefined}
+ singleLine={rowHeight === "s"}
+ />
+ ),
headerTooltip: {
description: "Add metadata to traces to track additional information.",
href: "https://langfuse.com/docs/observability/features/metadata",
@@ -1005,7 +1035,7 @@ export default function ObservationsTable({
enableHiding: true,
defaultHidden: true,
cell: () => {
- return isColumnLoading ? <Skeleton className="h-3 w-1/2" /> : null;
+ return isColumnLoading ? <TableTextLoadingCell /> : null;
},
columns: scoreColumns,
},
@@ -1091,9 +1121,7 @@ export default function ObservationsTable({
enableHiding: true,
defaultHidden: true,
cell: () => {
- return generations.isPending ? (
- <Skeleton className="h-3 w-1/2" />
- ) : null;
+ return generations.isPending ? <TableTextLoadingCell /> : null;
},
columns: [
{
@@ -1126,6 +1154,7 @@ export default function ObservationsTable({
id: "inputTokens",
header: "Input Tokens",
size: 100,
+ loadingCell: <TableTextLoadingCell />,
enableHiding: true,
defaultHidden: true,
enableSorting,
@@ -1143,6 +1172,7 @@ export default function ObservationsTable({
id: "outputTokens",
header: "Output Tokens",
size: 100,
+ loadingCell: <TableTextLoadingCell />,
enableHiding: true,
defaultHidden: true,
enableSorting,
@@ -1160,6 +1190,7 @@ export default function ObservationsTable({
id: "totalTokens",
header: "Total Tokens",
size: 100,
+ loadingCell: <TableTextLoadingCell />,
enableHiding: true,
defaultHidden: true,
enableSorting,
@@ -1181,9 +1212,7 @@ export default function ObservationsTable({
enableHiding: true,
defaultHidden: true,
cell: () => {
- return generations.isPending ? (
- <Skeleton className="h-3 w-1/2" />
- ) : null;
+ return generations.isPending ? <TableTextLoadingCell /> : null;
},
columns: [
{
@@ -1191,6 +1220,7 @@ export default function ObservationsTable({
id: "inputCost",
header: "Input Cost",
size: 120,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }: { row: Row<ObservationsTableRow> }) => {
const value: {
inputCost: number | undefined;
@@ -1210,6 +1240,7 @@ export default function ObservationsTable({
id: "outputCost",
header: "Output Cost",
size: 120,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }: { row: Row<ObservationsTableRow> }) => {
const value: {
inputCost: number | undefined;
diff --git a/web/src/components/table/use-cases/scores.tsx b/web/src/components/table/use-cases/scores.tsx
index 2efe3d3863..5a43d790ba 100644
--- a/web/src/components/table/use-cases/scores.tsx
+++ b/web/src/components/table/use-cases/scores.tsx
@@ -5,6 +5,10 @@ import {
DataTableControlsProvider,
DataTableControls,
} from "@/src/components/table/data-table-controls";
+import {
+ TableBadgeLoadingCell,
+ TableTextLoadingCell,
+} from "@/src/components/table/loading-cells";
import { ResizableFilterLayout } from "@/src/components/table/resizable-filter-layout";
import TableLink from "@/src/components/table/table-link";
import { type LangfuseColumnDef } from "@/src/components/table/types";
@@ -58,7 +62,6 @@ import { useTableViewManager } from "@/src/components/table/table-view-presets/h
import TableIdOrName from "@/src/components/table/table-id";
import { usePaginationState } from "@/src/hooks/usePaginationState";
import { useV4Beta } from "@/src/features/events/hooks/useV4Beta";
-import { Skeleton } from "@/src/components/ui/skeleton";
export type ScoresTableRow = {
id: string;
@@ -452,9 +455,10 @@ export default function ScoresTable({
enableHiding: true,
enableSorting: true,
size: 150,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
if (isBetaEnabled && !scoreMetrics.data)
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
const value = row.getValue("traceName") as ScoresTableRow["traceName"];
const filter = encodeURIComponent(
`name;stringOptions;;any of;${value}`,
@@ -546,6 +550,7 @@ export default function ScoresTable({
id: "environment",
size: 150,
enableHiding: true,
+ loadingCell: <TableBadgeLoadingCell />,
cell: ({ row }) => {
const value = row.getValue("environment") as string | undefined;
return value ? (
@@ -569,9 +574,10 @@ export default function ScoresTable({
enableHiding: true,
enableSorting: true,
size: 100,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
if (isBetaEnabled && !scoreMetrics.data)
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
const value = row.getValue("userId");
return typeof value === "string" ? (
<>
@@ -632,6 +638,13 @@ export default function ScoresTable({
header: "Metadata",
id: "metadata",
size: 400,
+ loadingCell: () => (
+ <IOTableCell
+ isLoading
+ data={undefined}
+ singleLine={rowHeight === "s"}
+ />
+ ),
headerTooltip: {
description: "Add metadata to scores to track additional information.",
// TODO: docs for metadata on scores
@@ -655,6 +668,13 @@ export default function ScoresTable({
id: "comment",
enableHiding: true,
size: 400,
+ loadingCell: () => (
+ <IOTableCell
+ isLoading
+ data={undefined}
+ singleLine={rowHeight === "s"}
+ />
+ ),
cell: ({ row }) => {
const value = row.getValue("comment") as ScoresTableRow["comment"];
return (
@@ -715,9 +735,10 @@ export default function ScoresTable({
size: 250,
enableHiding: true,
defaultHidden: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
if (isBetaEnabled && !scoreMetrics.data)
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
const traceTags: string[] | undefined = row.getValue("traceTags");
return (
traceTags && (
diff --git a/web/src/components/table/use-cases/sessions.tsx b/web/src/components/table/use-cases/sessions.tsx
index 32522bb2d9..011eef4653 100644
--- a/web/src/components/table/use-cases/sessions.tsx
+++ b/web/src/components/table/use-cases/sessions.tsx
@@ -5,6 +5,11 @@ import {
DataTableControlsProvider,
DataTableControls,
} from "@/src/components/table/data-table-controls";
+import {
+ TableBadgeLoadingCell,
+ TableIconButtonLoadingCell,
+ TableTextLoadingCell,
+} from "@/src/components/table/loading-cells";
import { ResizableFilterLayout } from "@/src/components/table/resizable-filter-layout";
import TableLink from "@/src/components/table/table-link";
import { type LangfuseColumnDef } from "@/src/components/table/types";
@@ -42,7 +47,6 @@ import { usePaginationState } from "@/src/hooks/usePaginationState";
import { useTableDateRange } from "@/src/hooks/useTableDateRange";
import { toAbsoluteTimeRange } from "@/src/utils/date-range-utils";
import { joinTableCoreAndMetrics } from "@/src/components/table/utils/joinTableCoreAndMetrics";
-import { Skeleton } from "@/src/components/ui/skeleton";
import TagList from "@/src/features/tag/components/TagList";
import { useRowHeightLocalStorage } from "@/src/components/table/data-table-row-height-switch";
import { cn } from "@/src/utils/tailwind";
@@ -448,6 +452,7 @@ export default function SessionsTable({
isFixedPosition: true,
header: undefined,
size: 50,
+ loadingCell: <TableIconButtonLoadingCell />,
cell: ({ row }) => {
const bookmarked: SessionTableRow["bookmarked"] =
row.getValue("bookmarked");
@@ -501,11 +506,12 @@ export default function SessionsTable({
header: "Duration",
size: 130,
enableHiding: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: SessionTableRow["sessionDuration"] =
row.getValue("sessionDuration");
if (!sessionMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return value && typeof value === "number"
? formatIntervalSeconds(value)
@@ -519,6 +525,7 @@ export default function SessionsTable({
id: "environment",
size: 150,
enableHiding: true,
+ loadingCell: <TableBadgeLoadingCell />,
cell: ({ row }) => {
const value: SessionTableRow["environment"] =
row.getValue("environment");
@@ -539,7 +546,7 @@ export default function SessionsTable({
enableHiding: true,
defaultHidden: true,
cell: () => {
- return isColumnLoading ? <Skeleton className="h-3 w-1/2" /> : null;
+ return isColumnLoading ? <TableTextLoadingCell /> : null;
},
columns: scoreColumns,
},
@@ -550,10 +557,11 @@ export default function SessionsTable({
header: "User IDs",
size: 200,
enableHiding: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: SessionTableRow["userIds"] = row.getValue("userIds");
if (!sessionMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return value && Array.isArray(value) ? (
<div className="flex gap-1">
@@ -578,11 +586,12 @@ export default function SessionsTable({
},
enableHiding: true,
enableSorting: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: SessionTableRow["countTraces"] =
row.getValue("countTraces");
if (!sessionMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return value ? <span>{numberFormatter(value, 0)}</span> : undefined;
},
@@ -595,10 +604,11 @@ export default function SessionsTable({
enableHiding: true,
defaultHidden: true,
enableSorting: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: SessionTableRow["inputCost"] = row.getValue("inputCost");
if (!sessionMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return value ? (
<span>{usdFormatter(value.toNumber())}</span>
@@ -613,10 +623,11 @@ export default function SessionsTable({
enableHiding: true,
enableSorting: true,
defaultHidden: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: SessionTableRow["outputCost"] = row.getValue("outputCost");
if (!sessionMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return value ? (
<span>{usdFormatter(value.toNumber())}</span>
@@ -630,10 +641,11 @@ export default function SessionsTable({
size: 110,
enableHiding: true,
enableSorting: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: SessionTableRow["totalCost"] = row.getValue("totalCost");
if (!sessionMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return value ? (
<span>{usdFormatter(value.toNumber())}</span>
@@ -648,11 +660,12 @@ export default function SessionsTable({
enableHiding: true,
defaultHidden: true,
enableSorting: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: SessionTableRow["inputTokens"] =
row.getValue("inputTokens");
if (!sessionMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return value ? (
<span>{numberFormatter(Number(value), 0)}</span>
@@ -667,11 +680,12 @@ export default function SessionsTable({
enableHiding: true,
defaultHidden: true,
enableSorting: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: SessionTableRow["outputTokens"] =
row.getValue("outputTokens");
if (!sessionMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return value ? (
<span>{numberFormatter(Number(value), 0)}</span>
@@ -686,11 +700,12 @@ export default function SessionsTable({
enableHiding: true,
defaultHidden: true,
enableSorting: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: SessionTableRow["totalTokens"] =
row.getValue("totalTokens");
if (!sessionMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return value ? (
<span>{numberFormatter(Number(value), 0)}</span>
@@ -704,6 +719,7 @@ export default function SessionsTable({
size: 220,
enableHiding: true,
enableSorting: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const promptTokens: SessionTableRow["inputTokens"] =
row.getValue("inputTokens");
@@ -712,7 +728,7 @@ export default function SessionsTable({
const totalTokens: SessionTableRow["totalTokens"] =
row.getValue("totalTokens");
if (!sessionMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return (
<TokenUsageBadge
@@ -731,10 +747,11 @@ export default function SessionsTable({
size: 250,
enableHiding: true,
defaultHidden: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: SessionTableRow["traceTags"] = row.getValue("traceTags");
if (!sessionMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return (
value && (
diff --git a/web/src/components/table/use-cases/traces.tsx b/web/src/components/table/use-cases/traces.tsx
index 00ece8e66c..04efe2700e 100644
--- a/web/src/components/table/use-cases/traces.tsx
+++ b/web/src/components/table/use-cases/traces.tsx
@@ -5,6 +5,11 @@ import {
DataTableControlsProvider,
DataTableControls,
} from "@/src/components/table/data-table-controls";
+import {
+ TableBadgeLoadingCell,
+ TableIconButtonLoadingCell,
+ TableTextLoadingCell,
+} from "@/src/components/table/loading-cells";
import { ResizableFilterLayout } from "@/src/components/table/resizable-filter-layout";
import { Badge } from "@/src/components/ui/badge";
import { type LangfuseColumnDef } from "@/src/components/table/types";
@@ -47,7 +52,6 @@ import { useTableDateRange } from "@/src/hooks/useTableDateRange";
import { toAbsoluteTimeRange } from "@/src/utils/date-range-utils";
import { type ScoreAggregate } from "@langfuse/shared";
import { joinTableCoreAndMetrics } from "@/src/components/table/utils/joinTableCoreAndMetrics";
-import { Skeleton } from "@/src/components/ui/skeleton";
import useColumnOrder from "@/src/features/column-visibility/hooks/useColumnOrder";
import { BatchExportTableButton } from "@/src/components/BatchExportTableButton";
import { BreakdownTooltip } from "@/src/components/trace2/components/_shared/BreakdownToolTip";
@@ -611,6 +615,7 @@ export default function TracesTable({
id: "bookmarked",
size: 30,
isFixedPosition: true,
+ loadingCell: <TableIconButtonLoadingCell />,
cell: ({ row }: { row: Row<TracesTableRow> }) => {
const bookmarked: TracesTableRow["bookmarked"] =
row.getValue("bookmarked");
@@ -658,6 +663,14 @@ export default function TracesTable({
header: "Input",
id: "input",
size: 400,
+ loadingCell: () => (
+ <MemoizedIOTableCell
+ isLoading
+ data={undefined}
+ className="bg-muted/50"
+ singleLine={rowHeight === "s"}
+ />
+ ),
cell: ({ row }) => {
const traceId: TracesTableRow["id"] = row.getValue("id");
const traceTimestamp: TracesTableRow["timestamp"] =
@@ -679,6 +692,14 @@ export default function TracesTable({
header: "Output",
id: "output",
size: 400,
+ loadingCell: () => (
+ <MemoizedIOTableCell
+ isLoading
+ data={undefined}
+ className="bg-accent-light-green"
+ singleLine={rowHeight === "s"}
+ />
+ ),
cell: ({ row }) => {
const traceId: TracesTableRow["id"] = row.getValue("id");
const traceTimestamp: TracesTableRow["timestamp"] =
@@ -700,10 +721,11 @@ export default function TracesTable({
id: "levelCounts",
header: "Observation Levels",
size: 150,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: TracesTableRow["levelCounts"] =
row.getValue("levelCounts");
- if (!traceMetrics.data) return <Skeleton className="h-3 w-1/2" />;
+ if (!traceMetrics.data) return <TableTextLoadingCell />;
const counts: LevelCount[] = Object.entries(value).map(
([level, count]) => ({
@@ -723,9 +745,10 @@ export default function TracesTable({
header: "Latency",
size: 100,
// add seconds to the end of the latency
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: TracesTableRow["latency"] = row.getValue("latency");
- if (!traceMetrics.data) return <Skeleton className="h-3 w-1/2" />;
+ if (!traceMetrics.data) return <TableTextLoadingCell />;
return value !== undefined ? (
<span className="text-nowrap">{formatIntervalSeconds(value)}</span>
) : undefined;
@@ -739,9 +762,10 @@ export default function TracesTable({
header: "Tokens",
id: "tokens",
size: 180,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: TracesTableRow["usage"] = row.getValue("usage");
- if (!traceMetrics.data) return <Skeleton className="h-3 w-1/2" />;
+ if (!traceMetrics.data) return <TableTextLoadingCell />;
if (!value.inputUsage && !value.outputUsage && !value.totalUsage) {
return null;
}
@@ -768,9 +792,10 @@ export default function TracesTable({
id: "totalCost",
header: "Total Cost",
size: 130,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const cost: TracesTableRow["totalCost"] = row.getValue("totalCost");
- if (!traceMetrics.data) return <Skeleton className="h-3 w-1/2" />;
+ if (!traceMetrics.data) return <TableTextLoadingCell />;
return cost != null ? (
<BreakdownTooltip details={row.original.costDetails ?? []} isCost>
<div className="flex items-center gap-1">
@@ -793,6 +818,7 @@ export default function TracesTable({
id: "environment",
size: 150,
enableHiding: true,
+ loadingCell: <TableBadgeLoadingCell />,
cell: ({ row }) => {
const value: TracesTableRow["environment"] =
row.getValue("environment");
@@ -829,6 +855,7 @@ export default function TracesTable({
),
href: "https://langfuse.com/docs/observability/features/tags",
},
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const traceTags: string[] | undefined = row.getValue("tags");
return (
@@ -850,6 +877,13 @@ export default function TracesTable({
accessorKey: "metadata",
header: "Metadata",
size: 400,
+ loadingCell: () => (
+ <MemoizedIOTableCell
+ isLoading
+ data={undefined}
+ singleLine={rowHeight === "s"}
+ />
+ ),
headerTooltip: {
description: (
<>
@@ -895,9 +929,7 @@ export default function TracesTable({
enableHiding: true,
defaultHidden: true,
cell: () => {
- return isColumnLoading ? (
- <Skeleton className="h-3 w-1/2" />
- ) : null;
+ return isColumnLoading ? <TableTextLoadingCell /> : null;
},
columns: scoreColumns,
},
@@ -981,10 +1013,11 @@ export default function TracesTable({
},
enableHiding: true,
defaultHidden: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: TracesTableRow["observationCount"] =
row.getValue("observationCount");
- if (!traceMetrics.data) return <Skeleton className="h-3 w-1/2" />;
+ if (!traceMetrics.data) return <TableTextLoadingCell />;
return <span>{numberFormatter(value, 0)}</span>;
},
},
@@ -993,9 +1026,10 @@ export default function TracesTable({
id: "level",
header: "Level",
size: 75,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: TracesTableRow["level"] = row.getValue("level");
- if (!traceMetrics.data) return <Skeleton className="h-3 w-1/2" />;
+ if (!traceMetrics.data) return <TableTextLoadingCell />;
return value ? (
<span
className={cn(
@@ -1092,9 +1126,7 @@ export default function TracesTable({
enableHiding: true,
defaultHidden: true,
cell: () => {
- return traceMetrics.isPending ? (
- <Skeleton className="h-3 w-1/2" />
- ) : null;
+ return traceMetrics.isPending ? <TableTextLoadingCell /> : null;
},
columns: [
{
@@ -1102,9 +1134,10 @@ export default function TracesTable({
id: "inputCost",
header: "Input Cost",
size: 100,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }: { row: Row<TracesTableRow> }) => {
const cost: TracesTableRow["cost"] = row.getValue("cost");
- if (!traceMetrics.data) return <Skeleton className="h-3 w-1/2" />;
+ if (!traceMetrics.data) return <TableTextLoadingCell />;
return (
<div>
{cost?.inputCost ? (
@@ -1124,9 +1157,10 @@ export default function TracesTable({
id: "outputCost",
header: "Output Cost",
size: 100,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }: { row: Row<TracesTableRow> }) => {
const cost: TracesTableRow["cost"] = row.getValue("cost");
- if (!traceMetrics.data) return <Skeleton className="h-3 w-1/2" />;
+ if (!traceMetrics.data) return <TableTextLoadingCell />;
return (
<div>
{cost?.outputCost ? (
@@ -1150,9 +1184,7 @@ export default function TracesTable({
enableHiding: true,
defaultHidden: true,
cell: () => {
- return traceMetrics.isPending ? (
- <Skeleton className="h-3 w-1/2" />
- ) : null;
+ return traceMetrics.isPending ? <TableTextLoadingCell /> : null;
},
columns: [
{
@@ -1160,9 +1192,10 @@ export default function TracesTable({
id: "inputTokens",
header: "Input Tokens",
size: 110,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }: { row: Row<TracesTableRow> }) => {
const value: TracesTableRow["usage"] = row.getValue("usage");
- if (!traceMetrics.data) return <Skeleton className="h-3 w-1/2" />;
+ if (!traceMetrics.data) return <TableTextLoadingCell />;
return <span>{numberFormatter(value.inputUsage, 0)}</span>;
},
enableHiding: true,
@@ -1174,9 +1207,10 @@ export default function TracesTable({
id: "outputTokens",
header: "Output Tokens",
size: 110,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }: { row: Row<TracesTableRow> }) => {
const value: TracesTableRow["usage"] = row.getValue("usage");
- if (!traceMetrics.data) return <Skeleton className="h-3 w-1/2" />;
+ if (!traceMetrics.data) return <TableTextLoadingCell />;
return <span>{numberFormatter(value.outputUsage, 0)}</span>;
},
enableHiding: true,
@@ -1188,9 +1222,10 @@ export default function TracesTable({
id: "totalTokens",
header: "Total Tokens",
size: 110,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }: { row: Row<TracesTableRow> }) => {
const value: TracesTableRow["usage"] = row.getValue("usage");
- if (!traceMetrics.data) return <Skeleton className="h-3 w-1/2" />;
+ if (!traceMetrics.data) return <TableTextLoadingCell />;
return <span>{numberFormatter(value.totalUsage, 0)}</span>;
},
enableHiding: true,
diff --git a/web/src/features/events/components/EventsTable.tsx b/web/src/features/events/components/EventsTable.tsx
index 5f6b4025d3..db457d2f53 100644
--- a/web/src/features/events/components/EventsTable.tsx
+++ b/web/src/features/events/components/EventsTable.tsx
@@ -19,6 +19,11 @@ import {
} from "../config/filter-config";
import { DEFAULT_SIDEBAR_IMPLICIT_ENVIRONMENT_CONFIG } from "@/src/features/filters/constants/internal-environments";
import { formatIntervalSeconds } from "@/src/utils/dates";
+import {
+ TableBadgeLoadingCell,
+ TableIconBadgeLoadingCell,
+ TableTextLoadingCell,
+} from "@/src/components/table/loading-cells";
import { type LangfuseColumnDef } from "@/src/components/table/types";
import {
type ObservationLevelType,
@@ -53,7 +58,6 @@ import { Badge } from "@/src/components/ui/badge";
import { type Row, type RowSelectionState } from "@tanstack/react-table";
import TableIdOrName from "@/src/components/table/table-id";
import { ItemBadge } from "@/src/components/ItemBadge";
-import { Skeleton } from "@/src/components/ui/skeleton";
import { PeekViewObservationDetail } from "@/src/components/table/peek/peek-observation-detail";
import { usePeekNavigation } from "@/src/components/table/peek/hooks/usePeekNavigation";
import { useDetailPageLists } from "@/src/features/navigate-detail-pages/context";
@@ -574,6 +578,7 @@ export default function ObservationsEventsTable({
id: "type",
header: getEventsColumnName("type"),
size: 50,
+ loadingCell: <TableIconBadgeLoadingCell />,
enableSorting,
cell: ({ row }) => {
const value: ObservationType = row.getValue("type");
@@ -611,6 +616,13 @@ export default function ObservationsEventsTable({
header: getEventsColumnName("input"),
id: "input",
size: 300,
+ loadingCell: () => (
+ <JsonSkeleton
+ numRows={rowHeight === "s" ? 1 : undefined}
+ borderless
+ className="h-full w-full overflow-hidden px-2 py-1"
+ />
+ ),
cell: ({ row }) => {
const value: string | undefined = row.getValue("input");
if (ioLoading) {
@@ -637,6 +649,13 @@ export default function ObservationsEventsTable({
id: "output",
header: getEventsColumnName("output"),
size: 300,
+ loadingCell: () => (
+ <JsonSkeleton
+ numRows={rowHeight === "s" ? 1 : undefined}
+ borderless
+ className="h-full w-full overflow-hidden px-2 py-1"
+ />
+ ),
cell: ({ row }) => {
const value: string | undefined = row.getValue("output");
if (ioLoading) {
@@ -663,6 +682,13 @@ export default function ObservationsEventsTable({
accessorKey: "metadata",
header: "Metadata",
size: 300,
+ loadingCell: () => (
+ <JsonSkeleton
+ numRows={rowHeight === "s" ? 1 : undefined}
+ borderless
+ className="h-full w-full overflow-hidden px-2 py-1"
+ />
+ ),
headerTooltip: {
description: "Add metadata to traces to track additional information.",
href: "https://langfuse.com/docs/observability/features/metadata",
@@ -784,7 +810,7 @@ export default function ObservationsEventsTable({
defaultHidden: true,
cell: () => {
return observations.status === "loading" ? (
- <Skeleton className="h-3 w-1/2" />
+ <TableTextLoadingCell />
) : null;
},
columns: [
@@ -793,6 +819,7 @@ export default function ObservationsEventsTable({
id: "inputCost",
header: getEventsColumnName("inputCost"),
size: 120,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }: { row: Row<EventsTableRow> }) => {
const value = row.getValue("cost") as {
inputCost: number | undefined;
@@ -812,6 +839,7 @@ export default function ObservationsEventsTable({
id: "outputCost",
header: getEventsColumnName("outputCost"),
size: 120,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }: { row: Row<EventsTableRow> }) => {
const value = row.getValue("cost") as {
inputCost: number | undefined;
@@ -884,7 +912,7 @@ export default function ObservationsEventsTable({
defaultHidden: true,
cell: () => {
return observations.status === "loading" ? (
- <Skeleton className="h-3 w-1/2" />
+ <TableTextLoadingCell />
) : null;
},
columns: [
@@ -918,6 +946,7 @@ export default function ObservationsEventsTable({
id: "inputTokens",
header: getEventsColumnName("inputTokens"),
size: 100,
+ loadingCell: <TableTextLoadingCell />,
enableHiding: true,
defaultHidden: true,
enableSorting,
@@ -935,6 +964,7 @@ export default function ObservationsEventsTable({
id: "outputTokens",
header: getEventsColumnName("outputTokens"),
size: 100,
+ loadingCell: <TableTextLoadingCell />,
enableHiding: true,
defaultHidden: true,
enableSorting,
@@ -952,6 +982,7 @@ export default function ObservationsEventsTable({
id: "totalTokens",
header: getEventsColumnName("totalTokens"),
size: 100,
+ loadingCell: <TableTextLoadingCell />,
enableHiding: true,
defaultHidden: true,
enableSorting,
@@ -1034,6 +1065,7 @@ export default function ObservationsEventsTable({
id: "environment",
size: 150,
enableHiding: true,
+ loadingCell: <TableBadgeLoadingCell />,
cell: ({ row }) => {
const value: EventsTableRow["environment"] =
row.getValue("environment");
@@ -1053,6 +1085,7 @@ export default function ObservationsEventsTable({
header: getEventsColumnName("traceTags"),
size: 250,
enableHiding: true,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const traceTags: string[] | undefined = row.getValue("traceTags");
return (
@@ -1077,7 +1110,7 @@ export default function ObservationsEventsTable({
enableHiding: true,
defaultHidden: true,
cell: () => {
- return isColumnLoading ? <Skeleton className="h-3 w-1/2" /> : null;
+ return isColumnLoading ? <TableTextLoadingCell /> : null;
},
columns: scoreColumns,
},
@@ -1088,7 +1121,7 @@ export default function ObservationsEventsTable({
enableHiding: true,
defaultHidden: true,
cell: () => {
- return isTraceColumnLoading ? <Skeleton className="h-3 w-1/2" /> : null;
+ return isTraceColumnLoading ? <TableTextLoadingCell /> : null;
},
columns: traceScoreColumns,
},
diff --git a/web/src/features/table/components/TableSelectionManager.tsx b/web/src/features/table/components/TableSelectionManager.tsx
index c311fa1a47..f23ebba0ee 100644
--- a/web/src/features/table/components/TableSelectionManager.tsx
+++ b/web/src/features/table/components/TableSelectionManager.tsx
@@ -1,3 +1,4 @@
+import { TableCheckboxLoadingCell } from "@/src/components/table/loading-cells";
import { Checkbox } from "@/src/components/ui/checkbox";
import {
type Table,
@@ -26,6 +27,7 @@ export function TableSelectionManager<TData>({
size: 35,
isFixedPosition: true,
isPinnedLeft: true,
+ loadingCell: <TableCheckboxLoadingCell />,
header: ({ table }: { table: Table<TData> }) => (
<div className="flex h-full items-center">
<Checkbox
diff --git a/web/src/pages/project/[projectId]/users.tsx b/web/src/pages/project/[projectId]/users.tsx
index 2cfdb2e9b2..069fbfd083 100644
--- a/web/src/pages/project/[projectId]/users.tsx
+++ b/web/src/pages/project/[projectId]/users.tsx
@@ -9,9 +9,12 @@ import {
} from "use-query-params";
import { DataTableToolbar } from "@/src/components/table/data-table-toolbar";
import { DataTable } from "@/src/components/table/data-table";
+import {
+ TableBadgeLoadingCell,
+ TableTextLoadingCell,
+} from "@/src/components/table/loading-cells";
import TableLink from "@/src/components/table/table-link";
import { type LangfuseColumnDef } from "@/src/components/table/types";
-import { Skeleton } from "@/src/components/ui/skeleton";
import { useQueryFilterState } from "@/src/features/filters/hooks/useFilterState";
import { useDetailPageLists } from "@/src/features/navigate-detail-pages/context";
import { useV4Beta } from "@/src/features/events/hooks/useV4Beta";
@@ -309,6 +312,7 @@ const UsersTable = ({ isBetaEnabled }: { isBetaEnabled: boolean }) => {
id: "environment",
size: 150,
enableHiding: true,
+ loadingCell: <TableBadgeLoadingCell />,
cell: ({ row }) => {
const value: RowData["environment"] = row.getValue("environment");
return value ? (
@@ -328,10 +332,11 @@ const UsersTable = ({ isBetaEnabled }: { isBetaEnabled: boolean }) => {
description: "The earliest trace recorded for this user.",
},
size: 150,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: RowData["firstEvent"] = row.getValue("firstEvent");
if (!userMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return typeof value === "string" ? value : undefined;
},
@@ -343,10 +348,11 @@ const UsersTable = ({ isBetaEnabled }: { isBetaEnabled: boolean }) => {
description: "The latest trace recorded for this user.",
},
size: 150,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: RowData["lastEvent"] = row.getValue("lastEvent");
if (!userMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return typeof value === "string" ? value : undefined;
},
@@ -360,10 +366,11 @@ const UsersTable = ({ isBetaEnabled }: { isBetaEnabled: boolean }) => {
href: "https://langfuse.com/docs/observability/data-model",
},
size: 120,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: RowData["totalEvents"] = row.getValue("totalEvents");
if (!userMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return typeof value === "string" ? value : undefined;
},
@@ -377,10 +384,11 @@ const UsersTable = ({ isBetaEnabled }: { isBetaEnabled: boolean }) => {
href: "https://langfuse.com/docs/model-usage-and-cost",
},
size: 120,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: RowData["totalTokens"] = row.getValue("totalTokens");
if (!userMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return typeof value === "string" ? value : undefined;
},
@@ -393,10 +401,11 @@ const UsersTable = ({ isBetaEnabled }: { isBetaEnabled: boolean }) => {
href: "https://langfuse.com/docs/model-usage-and-cost",
},
size: 120,
+ loadingCell: <TableTextLoadingCell />,
cell: ({ row }) => {
const value: RowData["totalCost"] = row.getValue("totalCost");
if (!userMetrics.isSuccess) {
- return <Skeleton className="h-3 w-1/2" />;
+ return <TableTextLoadingCell />;
}
return typeof value === "string" ? value : undefined;
},