🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(experiments): drop the empty Analytics tab, merge the table settings, explain an empty window (#16915)
Nikita Kabardind893bdae765d
diff --git a/web/redirects.mjs b/web/redirects.mjsindex fb434e5b7c..ed25e61670 100644--- a/web/redirects.mjs+++ b/web/redirects.mjs@@ -5,4 +5,14 @@ export const renamedRouteRedirects = [destination: "/project/:projectId/alerts/:path*",permanent: true,},+ {+ // The experiments Analytics tab was a "Coming Soon" card; its aggregates+ // move into the results table. The list is the destination rather than+ // `results`, which needs a `baseline` an old analytics bookmark never+ // carried. Temporary, so a future analytics surface at this path is not+ // shadowed by a cached 308.+ source: "/project/:projectId/experiments/analytics",+ destination: "/project/:projectId/experiments",+ permanent: false,+ },];diff --git a/web/src/components/table/data-table-column-visibility-filter.tsx b/web/src/components/table/data-table-column-visibility-filter.tsxindex 14bc3fbb48..7b86536442 100644--- a/web/src/components/table/data-table-column-visibility-filter.tsx+++ b/web/src/components/table/data-table-column-visibility-filter.tsx@@ -62,6 +62,9 @@ interface DataTableColumnVisibilityFilterProps<TData, TValue> {columnOrder?: ColumnOrderState;setColumnOrder?: Dispatch<SetStateAction<ColumnOrderState>>;triggerSize?: ComponentProps<typeof Button>["size"];+ /** Defaults to "Columns"; overridden where the surrounding surface already+ * says "Columns" (the merged table-settings popover). */+ triggerLabel?: string;tableName?: string;isV4?: boolean;onColumnGroupToggle?: (payload: ColumnGroupTogglePayload) => void;@@ -315,6 +318,7 @@ export function DataTableColumnVisibilityFilter<TData, TValue>({columnOrder,setColumnOrder,triggerSize,+ triggerLabel = "Columns",tableName = "unknown",isV4 = false,onColumnGroupToggle,@@ -424,7 +428,7 @@ export function DataTableColumnVisibilityFilter<TData, TValue>({size={triggerSize}title="Show/hide columns">- <span>Columns</span>+ <span>{triggerLabel}</span><div className="bg-input ml-1 rounded-sm px-1 text-xs">{`${count}/${total}`}</div></Button></DrawerTrigger>diff --git a/web/src/components/table/data-table-row-height-switch.tsx b/web/src/components/table/data-table-row-height-switch.tsxindex a04b45a763..8a538f85df 100644--- a/web/src/components/table/data-table-row-height-switch.tsx+++ b/web/src/components/table/data-table-row-height-switch.tsx@@ -13,7 +13,8 @@ import useLocalStorage from "@/src/components/useLocalStorage";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import { Rows3, Rows2, Rows4 } from "lucide-react";-const heightOptions = [+/** Exported so the merged "Table settings" popover offers the same options. */+export const ROW_HEIGHT_OPTIONS = [{ id: "s", label: "Small", icon: <Rows4 /> },{ id: "m", label: "Medium", icon: <Rows3 /> },{ id: "l", label: "Large", icon: <Rows2 /> },@@ -25,7 +26,7 @@ const defaultHeights: Record<RowHeight, string> = {l: "h-64",};-export type RowHeight = (typeof heightOptions)[number]["id"];+export type RowHeight = (typeof ROW_HEIGHT_OPTIONS)[number]["id"];export type CustomHeights = Record<RowHeight, string>;/**@@ -83,7 +84,7 @@ export const DataTableRowHeightSwitch = ({<DropdownMenuContent><DropdownMenuLabel>Row height</DropdownMenuLabel><DropdownMenuSeparator />- {heightOptions.map(({ id, label }) => (+ {ROW_HEIGHT_OPTIONS.map(({ id, label }) => (<DropdownMenuCheckboxItemkey={id}checked={rowHeight === id}diff --git a/web/src/components/table/data-table-settings-popover.tsx b/web/src/components/table/data-table-settings-popover.tsxnew file mode 100644index 0000000000..79e51ab787--- /dev/null+++ b/web/src/components/table/data-table-settings-popover.tsx@@ -0,0 +1,120 @@+import { type Dispatch, type SetStateAction } from "react";+import { SlidersHorizontal } from "lucide-react";+import {+ type ColumnOrderState,+ type VisibilityState,+} from "@tanstack/react-table";+import { Button } from "@/src/components/ui/button";+import { PopoverController } from "@/src/components/ui/popover";+import { Separator } from "@/src/components/ui/separator";+import {+ DataTableColumnVisibilityFilter,+ type ColumnGroupTogglePayload,+} from "@/src/components/table/data-table-column-visibility-filter";+import {+ ROW_HEIGHT_OPTIONS,+ type RowHeight,+} from "@/src/components/table/data-table-row-height-switch";+import { type LangfuseColumnDef } from "@/src/components/table/types";+import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";++/**+ * One "Table settings" surface for the controls that shape the same table —+ * columns and row height — instead of a button per control. Filed against the+ * old compare view as "fields vs. columns confused me as a new user"+ * and reproduced by the new experiments UI with one more control.+ *+ * The column list keeps its own drawer: it carries drag-to-reorder, groups and+ * restore-defaults, and it opens from inside this popover rather than from a+ * second button in the toolbar.+ */+export function DataTableSettingsPopover<TData, TValue>({+ columns,+ columnVisibility,+ setColumnVisibility,+ columnOrder,+ setColumnOrder,+ rowHeight,+ setRowHeight,+ tableName,+ isV4,+ onColumnGroupToggle,+}: {+ columns: LangfuseColumnDef<TData, TValue>[];+ columnVisibility: VisibilityState;+ setColumnVisibility: Dispatch<SetStateAction<VisibilityState>>;+ columnOrder?: ColumnOrderState;+ setColumnOrder?: Dispatch<SetStateAction<ColumnOrderState>>;+ rowHeight: RowHeight;+ setRowHeight: (rowHeight: RowHeight) => void;+ /** Analytics identity for the events fired from inside the+ * popover — the row-height buttons here and the column drawer's toggles. */+ tableName: string;+ isV4: boolean;+ onColumnGroupToggle?: (payload: ColumnGroupTogglePayload) => void;+}) {+ const capture = usePostHogClientCapture();++ return (+ <PopoverController+ align="end"+ contentClassName="w-60 p-2"+ disabled={false}+ modal={false}+ renderContent={() => (+ <div className="flex flex-col gap-2">+ <div>+ <p className="text-muted-foreground px-1 pb-1 text-xs">Columns</p>+ <DataTableColumnVisibilityFilter+ columns={columns}+ columnVisibility={columnVisibility}+ setColumnVisibility={setColumnVisibility}+ columnOrder={columnOrder}+ setColumnOrder={setColumnOrder}+ triggerLabel="Show / hide"+ tableName={tableName}+ isV4={isV4}+ onColumnGroupToggle={onColumnGroupToggle}+ />+ </div>+ <Separator />+ <div>+ <p className="text-muted-foreground px-1 pb-1 text-xs">+ Row height+ </p>+ <div className="grid grid-cols-3 gap-1">+ {ROW_HEIGHT_OPTIONS.map(({ id, label, icon }) => (+ <Button+ key={id}+ variant={rowHeight === id ? "secondary" : "ghost"}+ aria-pressed={rowHeight === id}+ className="h-auto flex-col gap-1 py-1.5"+ onClick={() => {+ capture("table:row_height_switch_select", {+ rowHeight: id,+ tableName,+ isV4,+ });+ setRowHeight(id);+ }}+ >+ {icon}+ <span className="text-xs">{label}</span>+ </Button>+ ))}+ </div>+ </div>+ </div>+ )}+ >+ {({ Trigger }) => (+ <Trigger asChild>+ <Button variant="outline" title="Table settings">+ <SlidersHorizontal className="h-4 w-4" />+ <span className="ml-2 hidden md:inline">Table settings</span>+ </Button>+ </Trigger>+ )}+ </PopoverController>+ );+}diff --git a/web/src/components/table/data-table-toolbar.clienttest.tsx b/web/src/components/table/data-table-toolbar.clienttest.tsxindex ea298955ec..537229c923 100644--- a/web/src/components/table/data-table-toolbar.clienttest.tsx+++ b/web/src/components/table/data-table-toolbar.clienttest.tsx@@ -180,3 +180,36 @@ describe("DataTableToolbar select-all banner gate", () => {});});});++describe("DataTableToolbar merged table settings", () => {+ const settingsProps = {+ columns: [],+ tableName: "test-table",+ columnVisibility: {},+ setColumnVisibility: vi.fn(),+ rowHeight: "s" as const,+ setRowHeight: vi.fn(),+ };++ it("renders Columns and row height as separate controls by default", () => {+ render(<DataTableToolbar {...settingsProps} />);++ expect(+ screen.getByRole("button", { name: /^Columns/ }),+ ).toBeInTheDocument();+ expect(+ screen.queryByRole("button", { name: "Table settings" }),+ ).not.toBeInTheDocument();+ });++ it("collapses both into one popover when opted in", () => {+ render(<DataTableToolbar {...settingsProps} mergeSettingsIntoPopover />);++ expect(+ screen.getByRole("button", { name: "Table settings" }),+ ).toBeInTheDocument();+ expect(+ screen.queryByRole("button", { name: /^Columns/ }),+ ).not.toBeInTheDocument();+ });+});diff --git a/web/src/components/table/data-table-toolbar.tsx b/web/src/components/table/data-table-toolbar.tsxindex 76ed877b23..0cbf4ac993 100644--- a/web/src/components/table/data-table-toolbar.tsx+++ b/web/src/components/table/data-table-toolbar.tsx@@ -5,6 +5,7 @@ import {DataTableColumnVisibilityFilter,type ColumnGroupTogglePayload,} from "@/src/components/table/data-table-column-visibility-filter";+import { DataTableSettingsPopover } from "@/src/components/table/data-table-settings-popover";import { FilterToggleButton } from "@/src/components/table/FilterToggleButton";import { PopoverFilterBuilder } from "@/src/features/filters/components/filter-builder";import {@@ -161,6 +162,11 @@ interface DataTableToolbarProps<TData, TValue> {* the filter toggle — e.g. the v4 events category-preset chips, so they* share the row with the right-aligned Columns/Export controls. */leadingControls?: React.ReactNode;+ /** Opt in to one "Table settings" popover for Columns + row height instead of+ * a button per control. Off everywhere else while the merged+ * shape is validated on the experiments list; needs both controls, so a+ * table that passes only one keeps its single button. */+ mergeSettingsIntoPopover?: boolean;}// Helper function to get the description for DocPopup@@ -231,6 +237,7 @@ export function DataTableToolbar<TData, TValue>({filterWithAI = false,viewModeToggle,leadingControls,+ mergeSettingsIntoPopover = false,}: DataTableToolbarProps<TData, TValue>) {const [searchString, setSearchString] = useState(searchConfig?.currentQuery ?? "",@@ -276,6 +283,12 @@ export function DataTableToolbar<TData, TValue>({// Only show the toggle button when we're using the new sidebarconst hasNewSidebar = !filterColumnDefinition && filterState !== undefined;+ const showMergedSettings =+ mergeSettingsIntoPopover &&+ !!columnVisibility &&+ !!setColumnVisibility &&+ !!rowHeight &&+ !!setRowHeight;return (<div className={cn("grid h-fit w-full gap-0 px-2", className)}><div@@ -469,25 +482,42 @@ export function DataTableToolbar<TData, TValue>({)}<div className="flex flex-row flex-wrap gap-2 pr-0.5 @3xl:ml-auto">- {!!columnVisibility && !!setColumnVisibility && (- <DataTableColumnVisibilityFilter+ {showMergedSettings ? (+ <DataTableSettingsPopovercolumns={columns}columnVisibility={columnVisibility}setColumnVisibility={setColumnVisibility}columnOrder={columnOrder}setColumnOrder={setColumnOrder}- tableName={analyticsTableName}- isV4={analyticsIsV4}- onColumnGroupToggle={onColumnGroupToggle}- />- )}- {!!rowHeight && !!setRowHeight && (- <DataTableRowHeightSwitchrowHeight={rowHeight}setRowHeight={setRowHeight}tableName={analyticsTableName}isV4={analyticsIsV4}+ onColumnGroupToggle={onColumnGroupToggle}/>+ ) : (+ <>+ {!!columnVisibility && !!setColumnVisibility && (+ <DataTableColumnVisibilityFilter+ columns={columns}+ columnVisibility={columnVisibility}+ setColumnVisibility={setColumnVisibility}+ columnOrder={columnOrder}+ setColumnOrder={setColumnOrder}+ tableName={analyticsTableName}+ isV4={analyticsIsV4}+ onColumnGroupToggle={onColumnGroupToggle}+ />+ )}+ {!!rowHeight && !!setRowHeight && (+ <DataTableRowHeightSwitch+ rowHeight={rowHeight}+ setRowHeight={setRowHeight}+ tableName={analyticsTableName}+ isV4={analyticsIsV4}+ />+ )}+ </>)}{actionButtons}</div>diff --git a/web/src/features/experiments/components/table/ExperimentsTable.tsx b/web/src/features/experiments/components/table/ExperimentsTable.tsxindex e522dd1fec..816f2173d6 100644--- a/web/src/features/experiments/components/table/ExperimentsTable.tsx+++ b/web/src/features/experiments/components/table/ExperimentsTable.tsx@@ -428,13 +428,19 @@ export default function ExperimentsTable({);// Use the custom hook for experiments data fetching- const { experiments, totalCount, dataUpdatedAt, metricsLoading } =- useExperimentsTableData({- projectId,- filterState,- orderByState,- paginationState,- });+ const {+ experiments,+ totalCount,+ dataUpdatedAt,+ metricsLoading,+ isShowingMostRecent,+ mostRecentCount,+ } = useExperimentsTableData({+ projectId,+ filterState,+ orderByState,+ paginationState,+ });// A score column that is empty for every experiment in view is noise, so only// create columns for the keys the metrics query actually returned. Undefined@@ -920,6 +926,7 @@ export default function ExperimentsTable({orderByState={orderByState}rowHeight={rowHeight}setRowHeight={setRowHeight}+ mergeSettingsIntoPopovertimeRange={showControlsInPageHeader ? undefined : timeRange}setTimeRange={showControlsInPageHeader ? undefined : setTimeRange}actionButtons={[@@ -933,6 +940,16 @@ export default function ExperimentsTable({/></div>+ {isShowingMostRecent && (+ <div className="text-muted-foreground border-t px-3 py-1.5 text-xs">+ No experiments started in the selected time range. Showing the{" "}+ {mostRecentCount === 1+ ? "most recent run"+ : `${mostRecentCount} most recent runs`}{" "}+ instead.+ </div>+ )}+{/* Content area with sidebar and table */}<ResizableFilterLayout><DataTableControlsdiff --git a/web/src/features/experiments/hooks/useExperimentsTableData.ts b/web/src/features/experiments/hooks/useExperimentsTableData.tsindex c9e1166141..f026a0c647 100644--- a/web/src/features/experiments/hooks/useExperimentsTableData.ts+++ b/web/src/features/experiments/hooks/useExperimentsTableData.ts@@ -24,6 +24,12 @@ type ExperimentMetricsData = {experimentScores: ScoreAggregate; // Experiment-level scores};+/**+ * How many runs the empty-window fallback shows: enough to see what the last+ * runs were, few enough that it reads as a fallback rather than a result set.+ */+const MOST_RECENT_FALLBACK_LIMIT = 10;+type UseExperimentsTableDataParams = {projectId: string;filterState: FilterState;@@ -78,36 +84,59 @@ export function useExperimentsTableData({refetchOnWindowFocus: true,});- // Build metrics payload based on experiments data+ // Fetch total count+ const totalCountQuery = api.experiments.countAll.useQuery(getCountPayload, {+ enabled: isProjectReady,+ refetchOnWindowFocus: true,+ });++ // An empty time range hides runs that exist just outside it, which reads as+ // "there are no experiments". Fall back to the most recent runs instead — on+ // the first page only, so paging stays honest.+ const isEmptyWindow =+ totalCountQuery.data?.count === 0 && paginationState.page === 1;++ const mostRecentQuery = api.experiments.mostRecent.useQuery(+ { ...getCountPayload, limit: MOST_RECENT_FALLBACK_LIMIT },+ {+ enabled: isProjectReady && isEmptyWindow,+ refetchOnWindowFocus: false,+ },+ );++ const fallbackRows = isEmptyWindow ? mostRecentQuery.data?.data : undefined;+ const isShowingMostRecent = Boolean(fallbackRows?.length);++ // The rows the table renders: the filtered page, or the fallback when the+ // selected range holds nothing.+ const coreRows = isShowingMostRecent+ ? fallbackRows+ : experimentsQuery.data?.data;++ const totalCount = isShowingMostRecent+ ? (fallbackRows?.length ?? null)+ : (totalCountQuery.data?.count ?? null);++ // Build metrics payload based on the rows in viewconst metricsPayload = useMemo(() => {- const experiments = experimentsQuery.data?.data;- if (!experiments || experiments.length === 0) {+ if (!coreRows || coreRows.length === 0) {return null;}return {projectId,- experimentIds: experiments.map((e) => e.id),+ experimentIds: coreRows.map((e) => e.id),filter: filterState,};- }, [experimentsQuery.data?.data, projectId, filterState]);+ }, [coreRows, projectId, filterState]);// Fetch metricsconst metricsQuery = api.experiments.metrics.useQuery(metricsPayload!, {- enabled:- isProjectReady && experimentsQuery.isSuccess && metricsPayload !== null,+ enabled: isProjectReady && metricsPayload !== null,refetchOnWindowFocus: false,staleTime: 0,});- // Fetch total count- const totalCountQuery = api.experiments.countAll.useQuery(getCountPayload, {- enabled: isProjectReady,- refetchOnWindowFocus: true,- });-- const totalCount = totalCountQuery.data?.count ?? null;-// Memoize joined data to prevent infinite re-renders// Handle loading, error, and success statesconst joinedData = useMemo(() => {@@ -121,16 +150,23 @@ export function useExperimentsTableData({return { status: "error" as const, rows: undefined };}+ // Don't render "no experiments" while the fallback is still in flight.+ if (isEmptyWindow && mostRecentQuery.isLoading) {+ return { status: "loading" as const, rows: undefined };+ }+// Success case - join the datareturn joinTableCoreAndMetrics<ExperimentCoreData, ExperimentMetricsData>(- experimentsQuery.data?.data,+ coreRows,metricsQuery.data,);}, [isProjectReady,experimentsQuery.isLoading,experimentsQuery.isError,- experimentsQuery.data?.data,+ isEmptyWindow,+ mostRecentQuery.isLoading,+ coreRows,metricsQuery.data,]);@@ -141,5 +177,13 @@ export function useExperimentsTableData({dataUpdatedAt,totalCount,metricsLoading: metricsQuery.isLoading,+ /** The rows shown are the most recent runs, not the selected time range. */+ isShowingMostRecent,+ /**+ * How many fallback runs are actually on screen. The cap is what was asked+ * for, not what came back, so a project with fewer runs than the cap must+ * not be told it is looking at ten of them.+ */+ mostRecentCount: fallbackRows?.length ?? 0,};}diff --git a/web/src/features/experiments/server/router.ts b/web/src/features/experiments/server/router.tsindex b41560a9fb..fbf35a977e 100644--- a/web/src/features/experiments/server/router.ts+++ b/web/src/features/experiments/server/router.ts@@ -1,5 +1,6 @@import { z } from "zod/v4";import { randomUUID } from "crypto";+import { addDays } from "date-fns";import {type ExperimentMetadata,createDatasetItemFilterState,@@ -43,6 +44,7 @@ import {isPresent,type DatasetItemDomain,singleFilter,+ type FilterState,orderBy,paginationZod,timeFilter,@@ -63,6 +65,13 @@ const ExperimentFilterOptions = z.object({...paginationZod,});+/**+ * Lookback for `mostRecent`: wide enough to cover a project whose last run is+ * months old, still bounded so the query prunes partitions instead of scanning+ * the whole project. Deliberately wider than any table date-range preset.+ */+const MOST_RECENT_LOOKBACK_DAYS = 365;+const ValidConfigResponse = z.object({isValid: z.literal(true),totalItems: z.number(),@@ -328,6 +337,50 @@ export const experimentsRouter = createTRPCRouter({};}),+ /**+ * The most recent runs regardless of the selected time range, for the empty+ * window on the experiments list ("if there's nothing in the last X days, I+ * still want to see the last ones"). Same scoping and filters as `all`, only+ * the start-time bounds are replaced.+ */+ mostRecent: protectedProjectProcedure+ .input(+ z.object({+ projectId: z.string(),+ filter: z.array(singleFilter).nullable(),+ limit: z.number().int().min(1).max(50),+ }),+ )+ .query(async ({ input, ctx }) => {+ throwIfNoProjectAccess({+ session: ctx.session,+ projectId: input.projectId,+ scope: "promptExperiments:read",+ });++ const filter: FilterState = [+ // The selected window is the one that came back empty; every other+ // filter the user applied still holds.+ ...(input.filter ?? []).filter((f) => f.column !== "startTime"),+ {+ column: "startTime",+ type: "datetime",+ operator: ">=",+ value: addDays(new Date(), -MOST_RECENT_LOOKBACK_DAYS),+ },+ ];++ const experiments = await getExperimentsFromEvents({+ projectId: input.projectId,+ filter,+ orderBy: { column: "startTime", order: "DESC" },+ page: 0,+ limit: input.limit,+ });++ return { data: experiments };+ }),+byId: protectedProjectProcedure.input(z.object({diff --git a/web/src/features/navigation/utils/experiment-run-tabs.ts b/web/src/features/navigation/utils/experiment-run-tabs.tsdeleted file mode 100644index b679802d32..0000000000--- a/web/src/features/navigation/utils/experiment-run-tabs.ts+++ /dev/null@@ -1,25 +0,0 @@-export const EXPERIMENT_RUN_TABS = {- RESULTS: "results",- ANALYTICS: "analytics",-} as const;--export const getExperimentRunTabs = (- projectId: string,- onResultsClick?: () => void,- onAnalyticsClick?: () => void,-) => [- {- value: EXPERIMENT_RUN_TABS.RESULTS,- label: "Results",- href: onResultsClick- ? undefined- : `/project/${projectId}/experiments/results`,- onClick: onResultsClick,- },- {- value: EXPERIMENT_RUN_TABS.ANALYTICS,- label: "Analytics",- href: `/project/${projectId}/experiments/analytics`,- onClick: onAnalyticsClick,- },-];diff --git a/web/src/pages/project/[projectId]/datasets/[datasetId]/experiments/index.tsx b/web/src/pages/project/[projectId]/datasets/[datasetId]/experiments/index.tsxindex d56e397815..65dbc24228 100644--- a/web/src/pages/project/[projectId]/datasets/[datasetId]/experiments/index.tsx+++ b/web/src/pages/project/[projectId]/datasets/[datasetId]/experiments/index.tsx@@ -93,6 +93,9 @@ export default function Dataset() {if (isExperimentsBetaActive) {utils.experiments.all.invalidate();utils.experiments.countAll.invalidate();+ // The empty-window fallback is its own query, and a new run belongs in+ // it: without this it keeps serving its cached list.+ utils.experiments.mostRecent.invalidate();} else {utils.datasets.runsByDatasetId.invalidate();utils.datasets.baseRunDataByDatasetId.invalidate();diff --git a/web/src/pages/project/[projectId]/experiments/analytics.tsx b/web/src/pages/project/[projectId]/experiments/analytics.tsxdeleted file mode 100644index 0aa6c5cf72..0000000000--- a/web/src/pages/project/[projectId]/experiments/analytics.tsx+++ /dev/null@@ -1,77 +0,0 @@-import { useRouter } from "next/router";-import Page from "@/src/components/layouts/page";-import { FlaskConical } from "lucide-react";-import { useExperimentAccess } from "@/src/features/experiments/hooks/useExperimentAccess";-import {- EXPERIMENT_RUN_TABS,- getExperimentRunTabs,-} from "@/src/features/navigation/utils/experiment-run-tabs";-import useSessionStorage from "@/src/components/useSessionStorage";-import Spinner from "@/src/components/design-system/Spinner/Spinner";-import { useEffect } from "react";--export default function ExperimentAnalytics() {- const router = useRouter();- const projectId = router.query.projectId as string;-- const { isExperimentsBetaActive, isInitializing } = useExperimentAccess();-- const [lastResultsUrl] = useSessionStorage<string | null>(- "experiment-results-url",- null,- );-- const handleResultsClick = () => {- const fallbackUrl = `/project/${projectId}/experiments`;- router.push(lastResultsUrl ?? fallbackUrl);- };-- useEffect(() => {- if (isInitializing || isExperimentsBetaActive || !projectId) return;-- router.replace(`/project/${projectId}/datasets`);- }, [isExperimentsBetaActive, isInitializing, projectId, router]);-- if (!isExperimentsBetaActive) {- return (- <Page headerProps={{ title: "Analytics" }}>- <div className="flex h-full items-center justify-center">- <Spinner size="xl" variant="muted" />- </div>- </Page>- );- }-- return (- <Page- headerProps={{- title: "Analytics",- itemType: "EXPERIMENT",- breadcrumb: [- { name: "Experiments", href: `/project/${projectId}/experiments` },- ],- tabsProps: {- tabs: getExperimentRunTabs(projectId, handleResultsClick),- activeTab: EXPERIMENT_RUN_TABS.ANALYTICS,- },- }}- >- <div className="flex h-full flex-col items-center justify-center p-8">- <div className="border-border bg-card/50 flex max-w-md flex-col items-center gap-4 rounded-xl border p-8 text-center shadow-sm backdrop-blur-sm">- <div className="bg-muted flex h-16 w-16 items-center justify-center rounded-full">- <FlaskConical className="text-muted-foreground h-8 w-8" />- </div>- <div className="space-y-2">- <h3 className="text-xl font-bold tracking-tight">- Analytics Coming Soon- </h3>- <p className="text-muted-foreground text-sm leading-relaxed">- We are working on adding advanced analytics capabilities for- experiments.- </p>- </div>- </div>- </div>- </Page>- );-}diff --git a/web/src/pages/project/[projectId]/experiments/index.tsx b/web/src/pages/project/[projectId]/experiments/index.tsxindex 43532f2a52..f9ab7280c2 100644--- a/web/src/pages/project/[projectId]/experiments/index.tsx+++ b/web/src/pages/project/[projectId]/experiments/index.tsx@@ -37,6 +37,9 @@ export default function Experiments() {await Promise.all([utils.experiments.all.invalidate(),utils.experiments.countAll.invalidate(),+ // The empty-window fallback is its own query, and a new run belongs in+ // it: without this it keeps serving its cached list.+ utils.experiments.mostRecent.invalidate(),]);};diff --git a/web/src/pages/project/[projectId]/experiments/results.tsx b/web/src/pages/project/[projectId]/experiments/results.tsxindex 56bec73e0b..5ecad894ad 100644--- a/web/src/pages/project/[projectId]/experiments/results.tsx+++ b/web/src/pages/project/[projectId]/experiments/results.tsx@@ -12,15 +12,9 @@ import { useExperimentResultsState } from "@/src/features/experiments/hooks/useEimport { useEffect } from "react";import { ExperimentDisplaySettings } from "@/src/features/experiments/components/ExperimentDisplaySettings";import { useExperimentAccess } from "@/src/features/experiments/hooks/useExperimentAccess";-import {- EXPERIMENT_RUN_TABS,- getExperimentRunTabs,-} from "@/src/features/navigation/utils/experiment-run-tabs";import Spinner from "@/src/components/design-system/Spinner/Spinner";import { ExperimentSelectionControls } from "@/src/features/experiments/components/ExperimentSelectionControls";import { useIoRenderModeLocalStorage } from "@/src/components/table/data-table-io-render-mode-switch";-import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";-import { analyticsTabOpenedProps } from "@/src/features/experiments/lib/analytics";export default function ExperimentResults() {const router = useRouter();@@ -49,17 +43,6 @@ export default function ExperimentResults() {false,);- const [, setLastResultsUrl] = useSessionStorage<string | null>(- "experiment-results-url",- `/project/${projectId}/datasets`,- );-- // Store current URL for back navigation from analytics- useEffect(() => {- setLastResultsUrl(window.location.pathname + window.location.search);- }, [setLastResultsUrl]);-- const capture = usePostHogClientCapture();const { isExperimentsBetaActive, isInitializing } = useExperimentAccess();useEffect(() => {@@ -98,18 +81,6 @@ export default function ExperimentResults() {breadcrumb: [{ name: "Experiments", href: `/project/${projectId}/experiments` },],- tabsProps: {- tabs: getExperimentRunTabs(projectId, undefined, () => {- capture(- "experiment:analytics_tab_opened",- analyticsTabOpenedProps({- tableName: "experiment-items",- hasComparison: comparisonIds.length > 0,- }),- );- }),- activeTab: EXPERIMENT_RUN_TABS.RESULTS,- },actionButtonsLeft: (<ExperimentSelectionControlsprojectId={projectId}