Skip to content

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

fix(evals): preserve page header while loading (#18124)

Tobias Wochinger2e00c2e9283d
diff --git a/web/src/features/evals/v2/components/Evaluators/EvaluatorSetupLoadingPage/EvaluatorSetupLoadingPage.tsx b/web/src/features/evals/v2/components/Evaluators/EvaluatorSetupLoadingPage/EvaluatorSetupLoadingPage.tsx
new file mode 100644
index 0000000000..e83a90ac06
--- /dev/null
+++ b/web/src/features/evals/v2/components/Evaluators/EvaluatorSetupLoadingPage/EvaluatorSetupLoadingPage.tsx
@@ -0,0 +1,23 @@
+import Page from "@/src/components/layouts/page";
+import { EvaluatorSetupLoadingState } from "./EvaluatorSetupLoadingState";
+
+export function EvaluatorSetupLoadingPage({
+ mode,
+ projectId,
+}: {
+ mode: "create" | "edit";
+ projectId?: string;
+}) {
+ return (
+ <Page
+ headerProps={{
+ title: mode === "create" ? "New evaluator" : "Configure evaluator",
+ breadcrumb: projectId
+ ? [{ name: "Evaluators", href: `/project/${projectId}/evals` }]
+ : undefined,
+ }}
+ >
+ <EvaluatorSetupLoadingState mode={mode} />
+ </Page>
+ );
+}
diff --git a/web/src/features/evals/v2/components/Evaluators/EvaluatorSetupLoadingPage/EvaluatorSetupLoadingState.stories.tsx b/web/src/features/evals/v2/components/Evaluators/EvaluatorSetupLoadingPage/EvaluatorSetupLoadingState.stories.tsx
new file mode 100644
index 0000000000..f37d093c3c
--- /dev/null
+++ b/web/src/features/evals/v2/components/Evaluators/EvaluatorSetupLoadingPage/EvaluatorSetupLoadingState.stories.tsx
@@ -0,0 +1,18 @@
+import preview from "../../../../../../../.storybook/preview";
+import { EvaluatorSetupLoadingState } from "./EvaluatorSetupLoadingState";
+
+const meta = preview.meta({
+ component: EvaluatorSetupLoadingState,
+});
+
+export const Creating = meta.story({
+ args: {
+ mode: "create",
+ },
+});
+
+export const Editing = meta.story({
+ args: {
+ mode: "edit",
+ },
+});
diff --git a/web/src/features/evals/v2/components/Evaluators/EvaluatorSetupLoadingPage/EvaluatorSetupLoadingState.tsx b/web/src/features/evals/v2/components/Evaluators/EvaluatorSetupLoadingPage/EvaluatorSetupLoadingState.tsx
new file mode 100644
index 0000000000..c21b474b23
--- /dev/null
+++ b/web/src/features/evals/v2/components/Evaluators/EvaluatorSetupLoadingPage/EvaluatorSetupLoadingState.tsx
@@ -0,0 +1,102 @@
+import { ArrowRight, FlaskConical, PanelRightClose } from "lucide-react";
+
+import { Button } from "@/src/components/ui/button";
+import { Skeleton } from "@/src/components/ui/skeleton";
+
+export function EvaluatorSetupLoadingState({
+ mode,
+}: {
+ mode: "create" | "edit";
+}) {
+ const isCreating = mode === "create";
+
+ return (
+ <div className="@container flex min-h-0 flex-1 flex-col" aria-busy="true">
+ <span className="sr-only" role="status">
+ Loading evaluator
+ </span>
+ <div className="flex min-h-0 flex-1 flex-col overflow-y-auto @3xl:grid @3xl:grid-cols-[minmax(0,3fr)_minmax(360px,2fr)] @3xl:overflow-hidden">
+ <div className="shrink-0 p-6 @3xl:min-h-0 @3xl:overflow-hidden">
+ <div className="flex gap-3">
+ <div className="bg-primary text-primary-foreground flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold">
+ 1
+ </div>
+ <div className="min-w-0 flex-1">
+ <h2 className="text-lg font-bold">Define evaluation</h2>
+ <Skeleton className="mt-2 h-3 w-3/4 max-w-lg" />
+ <Skeleton className="mt-2 h-3 w-1/2 max-w-sm" />
+ <Skeleton className="mt-6 h-64 w-full" />
+ </div>
+ </div>
+
+ <div className="mt-8 flex gap-3">
+ <div className="bg-primary text-primary-foreground flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold">
+ 2
+ </div>
+ <div className="min-w-0 flex-1">
+ <Skeleton className="h-5 w-36" />
+ <Skeleton className="mt-2 h-3 w-2/3 max-w-md" />
+ <div className="mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2">
+ <Skeleton className="h-9 w-full" />
+ <Skeleton className="h-9 w-full" />
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <aside className="flex shrink-0 flex-col overflow-hidden border-t @3xl:min-h-0 @3xl:border-t-0 @3xl:border-l">
+ <div className="flex h-12 shrink-0 items-center justify-between border-b px-6">
+ <div className="flex items-center gap-2">
+ <FlaskConical className="h-4 w-4" />
+ <h2 className="font-bold">Test with sample observations</h2>
+ </div>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ disabled
+ aria-label="Collapse test panel"
+ >
+ <PanelRightClose className="h-4 w-4" />
+ </Button>
+ </div>
+ <div className="flex min-h-0 flex-1 flex-col gap-6 overflow-hidden p-6">
+ <section>
+ <h3 className="text-sm font-bold">Filter observations</h3>
+ <Skeleton className="mt-2 h-3 w-3/4" />
+ <Skeleton className="mt-4 h-9 w-full" />
+ </section>
+ <section className="min-h-0">
+ <h3 className="text-sm font-bold">Matching observations</h3>
+ <Skeleton className="mt-2 h-3 w-2/3" />
+ <Skeleton className="mt-4 h-40 w-full" />
+ </section>
+ <section>
+ <h3 className="text-sm font-bold">Test the evaluator</h3>
+ <Skeleton className="mt-4 h-28 w-full" />
+ </section>
+ </div>
+ </aside>
+ </div>
+
+ <div className="flex shrink-0 items-center gap-4 border-t px-6 py-3">
+ {isCreating ? (
+ <p className="text-muted-foreground min-w-0 flex-1 text-sm">
+ Next: attach a rule to run this evaluator on incoming observations.
+ </p>
+ ) : null}
+ <div className="ml-auto flex shrink-0 gap-2">
+ <Button type="button" variant="outline" disabled>
+ Close
+ </Button>
+ <Button type="button" disabled className="gap-1.5">
+ {isCreating ? "Create evaluator" : "Save changes"}
+ {isCreating ? (
+ <ArrowRight className="h-4 w-4 shrink-0" aria-hidden="true" />
+ ) : null}
+ </Button>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/web/src/features/evals/v2/pages/EvaluatorDetailPage.tsx b/web/src/features/evals/v2/pages/EvaluatorDetailPage.tsx
index 25e4385658..51a9fa03c0 100644
--- a/web/src/features/evals/v2/pages/EvaluatorDetailPage.tsx
+++ b/web/src/features/evals/v2/pages/EvaluatorDetailPage.tsx
@@ -1,6 +1,6 @@
import { useRouter } from "next/router";
import type { EvalTemplateType } from "@langfuse/shared";
-import { Skeleton } from "@/src/components/ui/skeleton";
+import { EvaluatorSetupLoadingPage } from "@/src/features/evals/v2/components/Evaluators/EvaluatorSetupLoadingPage/EvaluatorSetupLoadingPage";
import { api, type RouterOutputs } from "@/src/utils/api";
import type { NormalizedEvaluatorDefinition } from "../server/evaluators/evaluatorTypes";
import { EvaluatorSetupPage } from "./EvaluatorSetupPage";
@@ -52,7 +52,7 @@ export default function EvaluatorDetailPage() {
);
if (evaluator.isPending) {
- return <Skeleton className="m-6 h-96 w-[calc(100%-3rem)]" />;
+ return <EvaluatorSetupLoadingPage mode="edit" projectId={projectId} />;
}
if (!evaluator.data?.versions[0]) {
return <div className="p-6">Evaluator not found</div>;
diff --git a/web/src/features/evals/v2/pages/NewEvaluatorPage.tsx b/web/src/features/evals/v2/pages/NewEvaluatorPage.tsx
index 82730bef21..79a9febc16 100644
--- a/web/src/features/evals/v2/pages/NewEvaluatorPage.tsx
+++ b/web/src/features/evals/v2/pages/NewEvaluatorPage.tsx
@@ -1,7 +1,7 @@
import { useRouter } from "next/router";
import { EvalTemplateTypeEnum } from "@langfuse/shared";
-import { Skeleton } from "@/src/components/ui/skeleton";
+import { EvaluatorSetupLoadingPage } from "@/src/features/evals/v2/components/Evaluators/EvaluatorSetupLoadingPage/EvaluatorSetupLoadingPage";
import { useEvalTemplate } from "@/src/features/evals/v2/hooks/useEvalTemplate";
import { EvaluatorSetupPage } from "./EvaluatorSetupPage";
@@ -32,7 +32,7 @@ export default function NewEvaluatorPage() {
});
if (!router.isReady || template.isPending) {
- return <Skeleton className="m-6 h-96 w-[calc(100%-3rem)]" />;
+ return <EvaluatorSetupLoadingPage mode="create" projectId={projectId} />;
}
if (template.isNotFound) {