🪢 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
fix(widgets): simplify fullscreen loading states and codex bootstrap db generation (#12801)
Max Deichmannc561a7da5dd6
diff --git a/AGENTS.md b/AGENTS.mdindex 9a4da293e5..d7bd822a49 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -69,7 +69,7 @@ langfuse/- Dev all packages: `pnpm run dev`- Dev web only: `pnpm run dev:web`- Dev worker only: `pnpm run dev:worker`-- Codex environment bootstrap: `bash scripts/codex/setup.sh` (installs deps, Playwright Chromium, and Prisma artifacts)+- Codex environment bootstrap: `bash scripts/codex/setup.sh` (installs deps, Playwright Chromium, runs `pnpm --filter=shared run db:generate`, and refreshes workspace Prisma artifacts)- Codex environment maintenance: `bash scripts/codex/maintenance.sh`- Install repo-local Playwright browsers for agents: `pnpm run playwright:install`- Lint all: `pnpm run lint`@@ -173,7 +173,7 @@ Minimum verification matrix:- Shared Playwright MCP configs live in `.mcp.json` and `.vscode/mcp.json`.- Codex project-scoped MCP config lives in `.codex/config.toml` for trusted-project setups.- Install Chromium into the default user-level Playwright cache with `pnpm run playwright:install`.-- `scripts/codex/setup.sh` runs the Playwright install step for first-time Codex bootstrap.+- `scripts/codex/setup.sh` runs the Playwright install step and an explicit `pnpm --filter=shared run db:generate` before workspace-wide `db:generate` for first-time Codex bootstrap.- Playwright MCP traces and other browser session artifacts live under `.playwright-mcp/` and are gitignored.- For user-visible frontend changes in `web/**`, review the affected flow in a real browser with the Playwright MCP server before signoff. Cover the primary changed path with a quick functional pass and a visual check for obvious regressions.- For web flows, start `pnpm run dev:web` (or `pnpm run dev`) before asking an agent to drive the app in a browser.diff --git a/scripts/codex/setup.sh b/scripts/codex/setup.shindex 04d8b3e93d..c25ec07fe1 100755--- a/scripts/codex/setup.sh+++ b/scripts/codex/setup.sh@@ -30,5 +30,9 @@ pnpm install --frozen-lockfile# browser review works on first bootstrap.pnpm run playwright:install+# Generate the shared Prisma client explicitly in the current worktree before+# the workspace-wide db:generate task, which may be satisfied by Turbo cache.+pnpm --filter=shared run db:generate+# Prisma client generation is needed for typecheck/build tasks in Codex.pnpm run db:generatediff --git a/web/src/__tests__/chart-loading-state-utils.clienttest.ts b/web/src/__tests__/chart-loading-state-utils.clienttest.tsindex d8f3da07f7..b95d84d9be 100644--- a/web/src/__tests__/chart-loading-state-utils.clienttest.ts+++ b/web/src/__tests__/chart-loading-state-utils.clienttest.ts@@ -1,5 +1,8 @@import { RESOURCE_LIMIT_ERROR_MESSAGE } from "@langfuse/shared";-import { getChartLoadingStateProps } from "@/src/features/widgets/chart-library/chartLoadingStateUtils";+import {+ getChartLoadingProgress,+ getChartLoadingStateProps,+} from "@/src/features/widgets/chart-library/chartLoadingStateUtils";describe("getChartLoadingStateProps", () => {test("returns spinner-only loading props while query is pending", () => {@@ -43,4 +46,24 @@ describe("getChartLoadingStateProps", () => {hintText: undefined,});});++ test("hides progress UI when backend streaming is not available", () => {+ expect(+ getChartLoadingProgress({+ isPending: true,+ progress: null,+ useBackendProgress: false,+ }),+ ).toBeUndefined();+ });++ test("keeps the loading bar visible while waiting for streamed progress", () => {+ expect(+ getChartLoadingProgress({+ isPending: true,+ progress: null,+ useBackendProgress: true,+ }),+ ).toBeNull();+ });});diff --git a/web/src/__tests__/chart-loading-state.clienttest.tsx b/web/src/__tests__/chart-loading-state.clienttest.tsxindex 9a9a6cd270..5a9d64f450 100644--- a/web/src/__tests__/chart-loading-state.clienttest.tsx+++ b/web/src/__tests__/chart-loading-state.clienttest.tsx@@ -13,38 +13,39 @@ describe("ChartLoadingState", () => {jest.useRealTimers();});- test("renders spinner immediately and delayed hint after configured delay", () => {+ test("keeps legacy pending state spinner-only without loading copy or hint", () => {const hintDelayMs = 1375;-- render(<ChartLoadingState isLoading={true} hintDelayMs={hintDelayMs} />);+ const { container } = render(+ <ChartLoadingState isLoading={true} hintDelayMs={hintDelayMs} />,+ );expect(screen.getByRole("status", { name: "Loading chart data" }),).toBeInTheDocument();+ expect(container.querySelector("svg")).toBeInTheDocument();+ expect(screen.queryByText("Loading widget")).not.toBeInTheDocument();expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();act(() => {- jest.advanceTimersByTime(hintDelayMs - 1);+ jest.advanceTimersByTime(hintDelayMs);});- expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();- act(() => {- jest.advanceTimersByTime(1);- });- expect(screen.getByText(SLOW_QUERY_HINT_TEXT)).toBeInTheDocument();+ expect(container.querySelector("svg")).toBeInTheDocument();+ expect(screen.queryByText("Loading widget")).not.toBeInTheDocument();+ expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();});- test("resets delayed hint when loading toggles off and on again", () => {+ test("keeps legacy pending state spinner-only when loading toggles off and on again", () => {const hintDelayMs = 825;-- const { rerender } = render(+ const { rerender, container } = render(<ChartLoadingState isLoading={true} hintDelayMs={hintDelayMs} />,);act(() => {jest.advanceTimersByTime(hintDelayMs);});- expect(screen.getByText(SLOW_QUERY_HINT_TEXT)).toBeInTheDocument();+ expect(container.querySelector("svg")).toBeInTheDocument();+ expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();rerender(<ChartLoadingState isLoading={false} hintDelayMs={hintDelayMs} />);expect(screen.queryByRole("status")).not.toBeInTheDocument();@@ -56,7 +57,8 @@ describe("ChartLoadingState", () => {act(() => {jest.advanceTimersByTime(hintDelayMs);});- expect(screen.getByText(SLOW_QUERY_HINT_TEXT)).toBeInTheDocument();+ expect(container.querySelector("svg")).toBeInTheDocument();+ expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();});test("shows hint immediately without spinner for overload state", () => {@@ -93,8 +95,31 @@ describe("ChartLoadingState", () => {expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();});- test("renders query progress details when progress is provided", () => {- render(+ test("shows only the spinner for the first second before swapping to the loading bar", () => {+ const { container } = render(+ <ChartLoadingState isLoading={true} progress={null} />,+ );++ expect(container.querySelector("svg")).toBeInTheDocument();+ expect(screen.queryByRole("progressbar")).not.toBeInTheDocument();++ act(() => {+ jest.advanceTimersByTime(999);+ });++ expect(container.querySelector("svg")).toBeInTheDocument();+ expect(screen.queryByRole("progressbar")).not.toBeInTheDocument();++ act(() => {+ jest.advanceTimersByTime(1);+ });++ expect(container.querySelector("svg")).not.toBeInTheDocument();+ expect(screen.getByRole("progressbar")).toBeInTheDocument();+ });++ test("renders query progress details when progress is provided after the spinner phase", () => {+ const { container } = render(<ChartLoadingStateisLoading={true}progress={{@@ -107,18 +132,88 @@ describe("ChartLoadingState", () => {/>,);+ act(() => {+ jest.advanceTimersByTime(1000);+ });++ expect(container.querySelector("svg")).not.toBeInTheDocument();+ expect(screen.getByText("Running query")).toBeInTheDocument();expect(screen.getByRole("progressbar")).toBeInTheDocument();expect(screen.getByText("Reading 1.8B / ~2.9B rows")).toBeInTheDocument();});- test("supports tight layout without rendering the default preview chrome", () => {- const { container } = render(- <ChartLoadingState isLoading={true} layout="tight" />,+ test("renders an indeterminate progress state while query progress is pending", () => {+ const progress = null;++ render(<ChartLoadingState isLoading={true} progress={progress} />);++ act(() => {+ jest.advanceTimersByTime(1000);+ });++ const progressbar = screen.getByRole("progressbar", {+ name: "Query progress",+ });++ expect(progressbar).toBeInTheDocument();+ expect(progressbar).not.toHaveAttribute("aria-valuenow");+ expect(progressbar.firstElementChild).toBeNull();+ expect(screen.getByText("Running query")).toBeInTheDocument();+ expect(screen.getByText("Reading query progress...")).toBeInTheDocument();+ });++ test("renders the delayed warning below the loading bar section", () => {+ render(+ <ChartLoadingState isLoading={true} progress={null} hintDelayMs={1500} />,);+ act(() => {+ jest.advanceTimersByTime(1000);+ });++ const progressText = screen.getByText("Reading query progress...");+ expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();++ act(() => {+ jest.advanceTimersByTime(500);+ });++ const hint = screen.getByText(SLOW_QUERY_HINT_TEXT);expect(- screen.getByRole("status", { name: "Loading chart data" }),- ).toBeInTheDocument();- expect(container.querySelector(".space-y-3")).not.toBeInTheDocument();+ progressText.compareDocumentPosition(hint) &+ Node.DOCUMENT_POSITION_FOLLOWING,+ ).toBeTruthy();+ });++ test("prioritizes the loading bar in tight layouts once the spinner phase ends", () => {+ render(+ <ChartLoadingState+ isLoading={true}+ progress={null}+ layout="tight"+ hintDelayMs={1500}+ />,+ );++ act(() => {+ jest.advanceTimersByTime(1000);+ });++ expect(screen.getByRole("progressbar")).toBeInTheDocument();+ expect(screen.queryByText("Running query")).not.toBeInTheDocument();++ act(() => {+ jest.advanceTimersByTime(500);+ });++ expect(screen.queryByText(SLOW_QUERY_HINT_TEXT)).not.toBeInTheDocument();+ });++ test("does not render skeleton preview chrome in the default layout", () => {+ const { container } = render(+ <ChartLoadingState isLoading={true} progress={null} />,+ );++ expect(container.querySelector(".rounded-xl")).not.toBeInTheDocument();});});diff --git a/web/src/__tests__/query-status-footer.clienttest.tsx b/web/src/__tests__/query-status-footer.clienttest.tsxdeleted file mode 100644index 783aa1783f..0000000000--- a/web/src/__tests__/query-status-footer.clienttest.tsx+++ /dev/null@@ -1,72 +0,0 @@-import React from "react";-import { act, render, screen } from "@testing-library/react";-import "@testing-library/jest-dom";-import { QueryStatusFooter } from "@/src/features/widgets/chart-library/QueryStatusFooter";--describe("QueryStatusFooter", () => {- beforeEach(() => {- jest.useFakeTimers();- });-- afterEach(() => {- jest.useRealTimers();- });-- test("shows running text and row progress immediately", () => {- render(- <QueryStatusFooter- isLoading={true}- progress={{- read_rows: 1_779_300_000,- total_rows_to_read: 2_924_500_000,- elapsed_ns: 0,- read_bytes: 0,- percent: 0.6084,- }}- />,- );-- expect(screen.getByText("Running query...")).toBeInTheDocument();- expect(screen.getByText("Reading 1.8B / ~2.9B rows")).toBeInTheDocument();- expect(- screen.queryByText("Try reducing the time range or adding more filters."),- ).not.toBeInTheDocument();- });-- test("shows short recommendation copy for tight widgets after delay", () => {- render(- <QueryStatusFooter- isLoading={true}- layout="tight"- hintDelayMs={900}- progress={{- read_rows: 1_736_400_000,- total_rows_to_read: 2_924_600_000,- elapsed_ns: 0,- read_bytes: 0,- percent: 0.5937,- }}- />,- );-- act(() => {- jest.advanceTimersByTime(900);- });-- expect(- screen.getByText("Add filters or reduce range."),- ).toBeInTheDocument();- });-- test("shows an indeterminate progress placeholder before query progress arrives", () => {- render(<QueryStatusFooter isLoading={true} />);-- const progressbar = screen.getByRole("progressbar", {- name: "Query progress",- });-- expect(progressbar).toBeInTheDocument();- expect(progressbar).not.toHaveAttribute("aria-valuenow");- expect(screen.getByText("Reading query progress...")).toBeInTheDocument();- });-});diff --git a/web/src/features/widgets/chart-library/ChartLoadingState.tsx b/web/src/features/widgets/chart-library/ChartLoadingState.tsxindex 6d85d05034..6f2032c7a0 100644--- a/web/src/features/widgets/chart-library/ChartLoadingState.tsx+++ b/web/src/features/widgets/chart-library/ChartLoadingState.tsx@@ -2,11 +2,11 @@ import { useEffect, useState } from "react";import { Loader2 } from "lucide-react";import { cn } from "@/src/utils/tailwind";import { SLOW_QUERY_HINT_TEXT } from "@langfuse/shared";-import { Skeleton } from "@/src/components/ui/skeleton";import { type QueryProgress } from "@/src/hooks/useSSEDashboardQuery";import { QueryProgressBar } from "@/src/features/widgets/chart-library/QueryProgressBar";const DEFAULT_HINT_DELAY_MS = 2000;+const PROGRESS_REVEAL_DELAY_MS = 1000;type ChartLoadingStateProps = {isLoading: boolean;@@ -22,23 +22,6 @@ type ChartLoadingStateProps = {layout?: "default" | "compact" | "tight";};-function ChartLoadingPreview() {- return (- <div aria-hidden="true" className="space-y-3">- <div className="flex items-end gap-2">- <Skeleton className="h-12 flex-1 rounded-xl" />- <Skeleton className="h-[4.5rem] flex-1 rounded-xl" />- <Skeleton className="h-8 flex-1 rounded-xl" />- <Skeleton className="h-14 flex-1 rounded-xl" />- </div>- <div className="flex gap-2">- <Skeleton className="h-2 flex-1 rounded-full" />- <Skeleton className="h-2 w-[4.5rem] rounded-full" />- </div>- </div>- );-}-export function ChartLoadingState({isLoading,className,@@ -53,6 +36,9 @@ export function ChartLoadingState({layout = "default",}: ChartLoadingStateProps) {const [showHint, setShowHint] = useState(false);+ const [showProgressPhase, setShowProgressPhase] = useState(false);+ const shouldShowProgress = progress !== undefined;+ const isPendingProgressState = isLoading && showSpinner && shouldShowProgress;useEffect(() => {if (!isLoading) {@@ -69,6 +55,21 @@ export function ChartLoadingState({};}, [hintDelayMs, isLoading]);+ useEffect(() => {+ if (!isPendingProgressState) {+ setShowProgressPhase(false);+ return;+ }++ const timeoutId = window.setTimeout(() => {+ setShowProgressPhase(true);+ }, PROGRESS_REVEAL_DELAY_MS);++ return () => {+ window.clearTimeout(timeoutId);+ };+ }, [isPendingProgressState]);+if (!isLoading) {return null;}@@ -76,8 +77,38 @@ export function ChartLoadingState({const shouldShowHint = showHintImmediately || showHint;const isCompact = layout !== "default";const isTight = layout === "tight";- const isTextOnlyState = !showSpinner;- const statusTitle = showSpinner ? "Loading widget" : "Query needs attention";+ const isLegacySpinnerOnlyState = showSpinner && !shouldShowProgress;+ const isTightProgressState = isTight && shouldShowProgress;+ const shouldRenderStatusTitle = !isTightProgressState;+ const shouldRenderHint = shouldShowHint && !isTightProgressState;++ if (+ isLegacySpinnerOnlyState ||+ (isPendingProgressState && !showProgressPhase)+ ) {+ return (+ <div+ role="status"+ aria-live="polite"+ aria-label={spinnerLabel}+ className={cn(+ "text-muted-foreground flex h-full w-full items-center justify-center",+ className,+ )}+ >+ <div className="flex h-4 w-4 items-center justify-center">+ <Loader2 className={cn("h-4 w-4 animate-spin", spinnerClassName)} />+ </div>+ </div>+ );+ }++ const statusTitle =+ isPendingProgressState || shouldShowProgress+ ? "Running query"+ : showSpinner+ ? "Loading widget"+ : "Query needs attention";return (<div@@ -89,72 +120,62 @@ export function ChartLoadingState({className,)}>- <div className="m-auto w-full max-w-sm px-4 py-4">- <div className={cn("flex flex-col", isCompact ? "gap-3" : "gap-5")}>- {!isCompact && !isTextOnlyState ? <ChartLoadingPreview /> : null}-- <div- className={cn(- "flex",- isTextOnlyState- ? "justify-center text-center"- : isCompact- ? "items-start gap-3 text-left"- : "flex-col items-center gap-3 text-center",- )}- >- {showSpinner ? (- <div- className={cn(- "bg-background/80 border-border/60 flex shrink-0 items-center justify-center rounded-full border shadow-xs",- isCompact ? "h-9 w-9" : "h-10 w-10",- )}- >- <Loader2- className={cn(- isCompact ? "h-4 w-4" : "h-5 w-5",- "animate-spin",- spinnerClassName,- )}- />- </div>- ) : null}-- <div+ <div+ className={cn(+ "m-auto w-full",+ isTightProgressState+ ? "max-w-[12rem] px-3 py-2"+ : "max-w-sm px-4 py-4",+ )}+ >+ <div+ className={cn(+ "flex flex-col",+ isTightProgressState ? "gap-2" : isCompact ? "gap-3" : "gap-4",+ )}+ >+ {shouldRenderStatusTitle ? (+ <pclassName={cn(- "space-y-1",- isCompact && !isTextOnlyState ? "min-w-0 flex-1" : "",+ "text-foreground font-medium",+ shouldShowProgress ? "text-left" : "text-center",+ isTight ? "text-xs" : "text-sm",)}>- <p- className={cn(- "text-foreground font-medium",- isTight ? "text-xs" : "text-sm",- )}- >- {statusTitle}- </p>- {shouldShowHint ? (- <p- className={cn(- "animate-in fade-in-0 text-muted-foreground duration-300",- isTight- ? "line-clamp-3 text-[11px] leading-4"- : isCompact- ? "line-clamp-4 text-xs leading-4"- : "line-clamp-3 text-xs leading-5",- hintClassName,- )}- >- {hintText}- </p>- ) : null}- </div>- </div>-- {progress ? (+ {statusTitle}+ </p>+ ) : null}+ {shouldShowProgress ? (<QueryProgressBar progress={progress} layout={layout} />+ ) : showSpinner ? (+ <div className="flex h-4 w-4 items-center justify-center self-center">+ <Loader2+ className={cn("h-4 w-4 animate-spin", spinnerClassName)}+ />+ </div>) : null}++ {isTightProgressState ? null : (+ <p+ className={cn(+ "text-muted-foreground",+ shouldShowProgress ? "text-left" : "text-center",+ shouldRenderHint ? "animate-in fade-in-0 duration-300" : "",+ isTight+ ? "line-clamp-3 min-h-12 text-[11px] leading-4"+ : isCompact+ ? "line-clamp-4 min-h-8 text-xs leading-4"+ : "line-clamp-3 min-h-10 text-xs leading-5",+ hintClassName,+ )}+ >+ {shouldRenderHint ? (+ hintText+ ) : (+ <span aria-hidden="true"> </span>+ )}+ </p>+ )}</div></div></div>diff --git a/web/src/features/widgets/chart-library/QueryProgressBar.tsx b/web/src/features/widgets/chart-library/QueryProgressBar.tsxindex de59da2752..c84dd2f250 100644--- a/web/src/features/widgets/chart-library/QueryProgressBar.tsx+++ b/web/src/features/widgets/chart-library/QueryProgressBar.tsx@@ -20,8 +20,11 @@ export function QueryProgressBar({layout = "default",}: QueryProgressBarProps) {const hasProgress = progress != null;- const percent = hasProgress ? Math.min(progress.percent * 100, 100) : 0;+ const percent = hasProgress+ ? Math.max(0, Math.min(progress.percent * 100, 100))+ : 0;const compactLayout = layout !== "default";+ const showProgressLabel = layout !== "tight";return (<div className={cn("w-full min-w-0", className)}>@@ -41,22 +44,22 @@ export function QueryProgressBar({className="bg-primary/60 h-full rounded-full transition-all duration-500 ease-out"style={{ width: `${percent}%` }}/>- ) : (- <div className="bg-primary/50 h-full w-1/3 animate-pulse rounded-full" />- )}+ ) : null}</div>- <p- className={cn(- "text-muted-foreground mt-2 tabular-nums",- compactLayout ? "text-[11px] leading-4" : "text-xs",- )}- >- {hasProgress- ? `Reading ${formatRows(progress.read_rows)} / ~${formatRows(- progress.total_rows_to_read,- )} rows`- : "Reading query progress..."}- </p>+ {showProgressLabel ? (+ <p+ className={cn(+ "text-muted-foreground mt-2 tabular-nums",+ compactLayout ? "text-[11px] leading-4" : "text-xs",+ )}+ >+ {hasProgress+ ? `Reading ${formatRows(progress.read_rows)} / ~${formatRows(+ progress.total_rows_to_read,+ )} rows`+ : "Reading query progress..."}+ </p>+ ) : null}</div>);}diff --git a/web/src/features/widgets/chart-library/QueryStatusFooter.tsx b/web/src/features/widgets/chart-library/QueryStatusFooter.tsxdeleted file mode 100644index 450a4384bd..0000000000--- a/web/src/features/widgets/chart-library/QueryStatusFooter.tsx+++ /dev/null@@ -1,86 +0,0 @@-import { useEffect, useState } from "react";-import { type QueryProgress } from "@/src/hooks/useSSEDashboardQuery";-import { cn } from "@/src/utils/tailwind";-import { QueryProgressBar } from "@/src/features/widgets/chart-library/QueryProgressBar";--const DEFAULT_HINT_DELAY_MS = 3000;-const DEFAULT_RECOMMENDATION_TEXT =- "Try reducing the time range or adding more filters.";-const COMPACT_RECOMMENDATION_TEXT = "Add filters or reduce range.";--type QueryStatusFooterProps = {- isLoading: boolean;- progress?: QueryProgress | null;- className?: string;- hintDelayMs?: number;- layout?: "default" | "compact" | "tight";- hintText?: string;-};--export function QueryStatusFooter({- isLoading,- progress,- className,- hintDelayMs = DEFAULT_HINT_DELAY_MS,- layout = "default",- hintText,-}: QueryStatusFooterProps) {- const [showHint, setShowHint] = useState(false);-- useEffect(() => {- if (!isLoading) {- setShowHint(false);- return;- }-- const timeoutId = window.setTimeout(() => {- setShowHint(true);- }, hintDelayMs);-- return () => {- window.clearTimeout(timeoutId);- };- }, [hintDelayMs, isLoading]);-- if (!isLoading) {- return null;- }-- const isTight = layout === "tight";- const isCompact = layout !== "default";- const recommendationText =- hintText ??- (isCompact ? COMPACT_RECOMMENDATION_TEXT : DEFAULT_RECOMMENDATION_TEXT);-- return (- <div- role="status"- aria-live="polite"- className={cn(- "border-border/50 border-t px-4 py-3",- isTight ? "space-y-1.5" : "space-y-2",- className,- )}- >- <p- className={cn(- "text-foreground/90 font-medium",- isCompact ? "text-xs" : "text-sm",- )}- >- Running query...- </p>-- <QueryProgressBar progress={progress} layout={layout} />-- <p- className={cn(- "text-muted-foreground min-h-[1rem]",- isCompact ? "text-[11px] leading-4" : "text-xs leading-5",- )}- >- {showHint ? recommendationText : <span aria-hidden="true"> </span>}- </p>- </div>- );-}diff --git a/web/src/features/widgets/chart-library/chartLoadingStateUtils.ts b/web/src/features/widgets/chart-library/chartLoadingStateUtils.tsindex a825026657..065b0c3730 100644--- a/web/src/features/widgets/chart-library/chartLoadingStateUtils.ts+++ b/web/src/features/widgets/chart-library/chartLoadingStateUtils.ts@@ -1,4 +1,5 @@import { RESOURCE_LIMIT_ERROR_MESSAGE } from "@langfuse/shared";+import { type QueryProgress } from "@/src/hooks/useSSEDashboardQuery";type ChartQueryState = {isPending: boolean;@@ -27,3 +28,19 @@ export function getChartLoadingStateProps({: undefined,};}++export function getChartLoadingProgress({+ isPending,+ progress,+ useBackendProgress,+}: {+ isPending: boolean;+ progress: QueryProgress | null;+ useBackendProgress: boolean;+}): QueryProgress | null | undefined {+ if (!isPending || !useBackendProgress) {+ return undefined;+ }++ return progress ?? null;+}diff --git a/web/src/features/widgets/components/DashboardWidget.tsx b/web/src/features/widgets/components/DashboardWidget.tsxindex 680028dec4..298e073d08 100644--- a/web/src/features/widgets/components/DashboardWidget.tsx+++ b/web/src/features/widgets/components/DashboardWidget.tsx@@ -25,8 +25,10 @@ import {shouldUseWidgetSSE,} from "@/src/features/widgets/utils";import { ChartLoadingState } from "@/src/features/widgets/chart-library/ChartLoadingState";-import { QueryStatusFooter } from "@/src/features/widgets/chart-library/QueryStatusFooter";-import { getChartLoadingStateProps } from "@/src/features/widgets/chart-library/chartLoadingStateUtils";+import {+ getChartLoadingProgress,+ getChartLoadingStateProps,+} from "@/src/features/widgets/chart-library/chartLoadingStateUtils";import { useV4Beta } from "@/src/features/events/hooks/useV4Beta";import { type ViewVersion } from "@/src/features/query";import { useScheduledDashboardExecuteQuery } from "@/src/hooks/useDashboardQueryScheduler";@@ -205,14 +207,21 @@ export function DashboardWidget({isError: queryResult.isError,errorMessage: queryResult.error,});+ const usesBackendProgress = shouldUseWidgetSSE({+ isV4BetaEnabled: isBetaEnabled,+ version: metricsVersion,+ });const loadingStateLayout =placement.y_size <= 2? "tight": placement.x_size <= 4? "compact": "default";- const showQueryErrorState =- chartLoadingState.isLoading && !queryResult.isPending;+ const loadingProgress = getChartLoadingProgress({+ isPending: queryResult.isPending,+ progress: queryResult.progress,+ useBackendProgress: usesBackendProgress,+ });const transformedData = useMemo(() => {if (!widget.data || !queryResult.data) {@@ -389,59 +398,48 @@ export function DashboardWidget({hintText={queryValidation.reason}layout={loadingStateLayout}className="bg-background/80 absolute inset-0 z-20 backdrop-blur-xs"- hintClassName="max-w-sm px-4"/></div>) : (- <>- <div className="relative min-h-0 flex-1">- <Chart- chartType={widget.data.chartType}- data={transformedData}- rowLimit={- widget.data.chartConfig.type === "LINE_TIME_SERIES" ||- widget.data.chartConfig.type === "BAR_TIME_SERIES" ||- widget.data.chartConfig.type === "AREA_TIME_SERIES"- ? 100- : (widget.data.chartConfig.row_limit ?? 100)- }- chartConfig={{- ...widget.data.chartConfig,- // For PIVOT_TABLE, enhance chartConfig with dimensions and metric field names- ...(widget.data.chartType === "PIVOT_TABLE" && {- dimensions: widget.data.dimensions.map((dim) => dim.field),- metrics: widget.data.metrics.map(- (metric) => `${metric.agg}_${metric.measure}`,- ),- }),- }}- sortState={- widget.data.chartType === "PIVOT_TABLE"- ? sortState- : undefined- }- onSortChange={- widget.data.chartType === "PIVOT_TABLE"- ? updateSort- : undefined- }- isLoading={queryResult.isPending}- />- <ChartLoadingState- isLoading={showQueryErrorState}- showSpinner={chartLoadingState.showSpinner}- showHintImmediately={chartLoadingState.showHintImmediately}- hintText={chartLoadingState.hintText}- className="bg-background/80 absolute inset-0 z-20 backdrop-blur-xs"- hintClassName="max-w-sm px-4"- />- </div>- <QueryStatusFooter+ <div className="relative min-h-0 flex-1">+ <Chart+ chartType={widget.data.chartType}+ data={transformedData}+ rowLimit={+ widget.data.chartConfig.type === "LINE_TIME_SERIES" ||+ widget.data.chartConfig.type === "BAR_TIME_SERIES" ||+ widget.data.chartConfig.type === "AREA_TIME_SERIES"+ ? 100+ : (widget.data.chartConfig.row_limit ?? 100)+ }+ chartConfig={{+ ...widget.data.chartConfig,+ // For PIVOT_TABLE, enhance chartConfig with dimensions and metric field names+ ...(widget.data.chartType === "PIVOT_TABLE" && {+ dimensions: widget.data.dimensions.map((dim) => dim.field),+ metrics: widget.data.metrics.map(+ (metric) => `${metric.agg}_${metric.measure}`,+ ),+ }),+ }}+ sortState={+ widget.data.chartType === "PIVOT_TABLE" ? sortState : undefined+ }+ onSortChange={+ widget.data.chartType === "PIVOT_TABLE" ? updateSort : undefined+ }isLoading={queryResult.isPending}- progress={queryResult.progress}+ />+ <ChartLoadingState+ isLoading={chartLoadingState.isLoading}+ showSpinner={chartLoadingState.showSpinner}+ showHintImmediately={chartLoadingState.showHintImmediately}+ hintText={chartLoadingState.hintText}+ progress={loadingProgress}layout={loadingStateLayout}+ className="bg-background/80 absolute inset-0 z-20 backdrop-blur-xs"/>- </>+ </div>)}</div></div>diff --git a/web/src/features/widgets/components/WidgetForm.tsx b/web/src/features/widgets/components/WidgetForm.tsxindex c129046582..edbcfbb6b3 100644--- a/web/src/features/widgets/components/WidgetForm.tsx+++ b/web/src/features/widgets/components/WidgetForm.tsx@@ -75,8 +75,10 @@ import {MAX_PIVOT_TABLE_METRICS,} from "@/src/features/widgets/utils/pivot-table-utils";import { ChartLoadingState } from "@/src/features/widgets/chart-library/ChartLoadingState";-import { QueryStatusFooter } from "@/src/features/widgets/chart-library/QueryStatusFooter";-import { getChartLoadingStateProps } from "@/src/features/widgets/chart-library/chartLoadingStateUtils";+import {+ getChartLoadingProgress,+ getChartLoadingStateProps,+} from "@/src/features/widgets/chart-library/chartLoadingStateUtils";type ChartType = {group: "time-series" | "total-value";@@ -983,6 +985,11 @@ export function WidgetForm({isPending: queryResult.isPending,isError: queryResult.isError,});+ const loadingProgress = getChartLoadingProgress({+ isPending: queryResult.isPending,+ progress: null,+ useBackendProgress: false,+ });// Transform the query results to a consistent format for chartsconst transformedData: DataPoint[] = useMemo(@@ -1943,20 +1950,14 @@ export function WidgetForm({isLoading={queryResult.isPending}/><ChartLoadingState- isLoading={- chartLoadingState.isLoading && !queryResult.isPending- }+ isLoading={chartLoadingState.isLoading}showSpinner={chartLoadingState.showSpinner}showHintImmediately={chartLoadingState.showHintImmediately}hintText={chartLoadingState.hintText}+ progress={loadingProgress}className="bg-background/80 absolute inset-0 z-20 backdrop-blur-xs"- hintClassName="max-w-sm px-4"/></div>- <QueryStatusFooter- isLoading={queryResult.isPending}- progress={null}- /></div>) : (<CardContent>@@ -1967,8 +1968,7 @@ export function WidgetForm({showSpinner={chartLoadingState.showSpinner}showHintImmediately={chartLoadingState.showHintImmediately}hintText={chartLoadingState.hintText}- progress={null}- hintClassName="max-w-sm px-4"+ progress={loadingProgress}/>) : (<p className="text-muted-foreground">