Skip to content

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

chore: upgrade react-resizable-panels to v4 (#12238)

Nimarc55ab46d2bbb
diff --git a/AGENTS.md b/AGENTS.md
index 285d88ae02..d3dbc4c022 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -2,6 +2,11 @@
Langfuse is an **open source LLM engineering** platform for developing, monitoring, evaluating and debugging AI applications. See the README for more details.
+## Codebase
+* Nextjs 15 without SSR
+* Typescript 5
+* Tailwind
+
## Linting
- Run `pnpm run lint` to lint all packages.
- Fix issues automatically with `pnpm run lint:fix`.
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 40bf4e3aa3..06969f0adc 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -60,7 +60,7 @@ importers:
next-auth:
specifier: ^4.24.13
zod:
specifier: ^3.25.62
version: 3.25.62
@@ -261,7 +261,7 @@ importers:
version: 4.1.1
next-auth:
specifier: ^4.24.13
nodemailer:
specifier: ^7.0.11
version: 7.0.11
@@ -403,7 +403,7 @@ importers:
'@langchain/core':
specifier: ^1.1.17
- version: 1.1.18(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])([email protected]))
+ version: 1.1.18(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected]))
'@langfuse/ee':
specifier: workspace:*
version: link:../ee
@@ -586,7 +586,7 @@ importers:
ai:
specifier: ^3.4.9
bcryptjs:
specifier: ^2.4.3
version: 2.4.3
@@ -652,7 +652,7 @@ importers:
version: 0.27.4
langchain:
specifier: ^1.2.15
langfuse:
specifier: 3.38.4
version: 3.38.4
@@ -670,7 +670,7 @@ importers:
next-auth:
specifier: ^4.24.13
next-query-params:
specifier: ^5.1.0
@@ -723,8 +723,8 @@ importers:
specifier: ^10.1.0
version: 10.1.0(@types/[email protected])([email protected])
react-resizable-panels:
- specifier: ^3.0.6
+ specifier: ^4.6.5
react-responsive:
specifier: ^10.0.1
version: 10.0.1([email protected])
@@ -803,7 +803,7 @@ importers:
'@testing-library/jest-dom':
specifier: ^6.4.6
'@testing-library/react':
specifier: ^15.0.7
@@ -1529,6 +1529,7 @@ packages:
'@aws-sdk/[email protected]':
resolution: {integrity: sha512-/BjMbtOM9lsgdNgRZWUL5oCV6Ocfx1vcK/C5xO5/t/gCk6IwR9JFWMilbk6K6Buq5F84/lkngqcCKU2SRkAmOg==}
engines: {node: '>= 14.0.0'}
+ deprecated: Please update your @aws-sdk client to a more recent version, such as https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.982.0, if using browser-based WebSocket bidirectional streaming.
'@aws-sdk/[email protected]':
resolution: {integrity: sha512-OuV2pypFAv52Lty8eXWVWyyOywVmMAsgH6Gq3SA06pHEtcE+ghVIW9ByegecyfMRUpedAiovARKNy0pfGX05Pg==}
@@ -8375,6 +8376,7 @@ packages:
resolution: {integrity: sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==}
+ deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]
hasBin: true
@@ -10918,11 +10920,11 @@ packages:
'@types/react':
optional: true
- resolution: {integrity: sha512-b3qKHQ3MLqOgSS+FRYKapNkJZf5EQzuf6+RLiq1/IlTHw99YrZ2NJZLk4hQIzTnnIkRg2LUqyVinu6YWWpUYew==}
+ resolution: {integrity: sha512-pmQP6qv9KmsesNMvWVNvVfVJAwYSOWWbAOAtrPR8Cre20+j1NWIlyft0btjtDQE+OepXmI6g3VPrCXQY0oD7+Q==}
peerDependencies:
- react: ^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc
- react-dom: ^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc
+ react: ^18.0.0 || ^19.0.0
+ react-dom: ^18.0.0 || ^19.0.0
resolution: {integrity: sha512-vKpeHhI5OZvYn82kXOs1bC8aOXktGU5AmKAgaZS4F5JPburCtbmDPqE7Pzp+1kN4+Wb81LlF33VpGwWwtXem+w==}
@@ -15984,14 +15986,14 @@ snapshots:
transitivePeerDependencies:
- aws-crt
+ '@langchain/[email protected](@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected]))':
dependencies:
'@cfworker/json-schema': 4.1.1
ansi-styles: 5.2.0
camelcase: 6.3.0
decamelize: 1.2.0
js-tiktoken: 1.0.21
- langsmith: 0.4.12(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])([email protected]))
+ langsmith: 0.4.12(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected]))
mustache: 4.2.0
p-queue: 6.6.2
uuid: 10.0.0
@@ -16046,9 +16048,9 @@ snapshots:
- '@langchain/core'
- supports-color
- '@langchain/[email protected](@langchain/[email protected](@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])([email protected])))':
+ '@langchain/[email protected](@langchain/[email protected](@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])))':
dependencies:
- '@langchain/core': 1.1.18(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])([email protected]))
+ '@langchain/core': 1.1.18(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected]))
uuid: 10.0.0
@@ -16056,13 +16058,13 @@ snapshots:
'@langchain/core': 1.1.18(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])([email protected]))
uuid: 10.0.0
dependencies:
p-queue: 9.1.0
p-retry: 7.1.1
uuid: 13.0.0
optionalDependencies:
- '@langchain/core': 1.1.18(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])([email protected]))
+ '@langchain/core': 1.1.18(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected]))
react: 19.2.3
react-dom: 19.2.3([email protected])
@@ -16076,11 +16078,11 @@ snapshots:
react: 19.2.3
react-dom: 19.2.3([email protected])
dependencies:
- '@langchain/core': 1.1.18(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])([email protected]))
- '@langchain/langgraph-checkpoint': 1.0.0(@langchain/[email protected](@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])([email protected])))
- '@langchain/langgraph-sdk': 1.5.5(@langchain/[email protected](@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])([email protected])))([email protected]([email protected]))([email protected])
+ '@langchain/core': 1.1.18(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected]))
+ '@langchain/langgraph-checkpoint': 1.0.0(@langchain/[email protected](@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])))
+ '@langchain/langgraph-sdk': 1.5.5(@langchain/[email protected](@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])))([email protected]([email protected]))([email protected])
'@standard-schema/spec': 1.1.0
uuid: 10.0.0
zod: 3.25.76
@@ -16330,7 +16332,7 @@ snapshots:
dependencies:
dependencies:
@@ -19325,7 +19327,7 @@ snapshots:
lz-string: 1.5.0
pretty-format: 27.5.1
dependencies:
'@adobe/css-tools': 4.4.0
'@babel/runtime': 7.24.7
@@ -20185,7 +20187,7 @@ snapshots:
clean-stack: 2.2.0
indent-string: 4.0.0
dependencies:
'@ai-sdk/provider': 0.0.24
'@ai-sdk/provider-utils': 1.0.20([email protected])
@@ -20202,7 +20204,7 @@ snapshots:
secure-json-parse: 2.7.0
zod-to-json-schema: 3.23.2([email protected])
optionalDependencies:
+ openai: 4.104.0([email protected])
react: 19.2.3
sswr: 2.1.0([email protected])
svelte: 4.2.19
@@ -21576,8 +21578,8 @@ snapshots:
'@typescript-eslint/parser': 8.50.1([email protected]([email protected]))([email protected])
eslint: 9.39.2([email protected])
eslint-import-resolver-node: 0.3.9
+ eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))
eslint-plugin-jsx-a11y: 6.10.2([email protected]([email protected]))
eslint-plugin-react: 7.37.5([email protected]([email protected]))
eslint-plugin-react-hooks: 5.2.0([email protected]([email protected]))
@@ -21595,7 +21597,7 @@ snapshots:
dependencies:
eslint: 9.39.2([email protected])
eslint-plugin-n: 16.6.2([email protected]([email protected]))
eslint-plugin-promise: 6.6.0([email protected]([email protected]))
@@ -21613,7 +21615,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@nolyfill/is-core-module': 1.0.39
debug: 4.4.3
@@ -21624,18 +21626,18 @@ snapshots:
tinyglobby: 0.2.15
unrs-resolver: 1.11.1
optionalDependencies:
transitivePeerDependencies:
- supports-color
dependencies:
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 8.50.1([email protected]([email protected]))([email protected])
eslint: 9.39.2([email protected])
eslint-import-resolver-node: 0.3.9
+ eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))
transitivePeerDependencies:
- supports-color
@@ -21646,7 +21648,7 @@ snapshots:
eslint: 9.39.2([email protected])
eslint-compat-utils: 0.5.1([email protected]([email protected]))
dependencies:
'@rtsao/scc': 1.1.0
array-includes: 3.1.9
@@ -21657,7 +21659,7 @@ snapshots:
doctrine: 2.1.0
eslint: 9.39.2([email protected])
eslint-import-resolver-node: 0.3.9
hasown: 2.0.2
is-core-module: 2.16.1
is-glob: 4.0.3
@@ -23513,12 +23515,12 @@ snapshots:
dependencies:
- '@langchain/core': 1.1.18(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])([email protected]))
- '@langchain/langgraph-checkpoint': 1.0.0(@langchain/[email protected](@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])([email protected])))
- langsmith: 0.4.12(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])([email protected]))
+ '@langchain/core': 1.1.18(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected]))
+ '@langchain/langgraph-checkpoint': 1.0.0(@langchain/[email protected](@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected])))
+ langsmith: 0.4.12(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected]([email protected]))
uuid: 10.0.0
zod: 3.25.76
transitivePeerDependencies:
@@ -23569,7 +23571,7 @@ snapshots:
dependencies:
langfuse-core: 3.38.6
dependencies:
'@types/uuid': 10.0.0
chalk: 4.1.2
@@ -23581,7 +23583,7 @@ snapshots:
'@opentelemetry/api': 1.9.0
'@opentelemetry/exporter-trace-otlp-proto': 0.53.0(@opentelemetry/[email protected])
'@opentelemetry/sdk-trace-base': 1.26.0(@opentelemetry/[email protected])
+ openai: 4.104.0([email protected])
dependencies:
@@ -24374,7 +24376,7 @@ snapshots:
dependencies:
type-fest: 2.19.0
dependencies:
'@babel/runtime': 7.28.4
'@panva/hkdf': 1.2.1
@@ -24631,7 +24633,7 @@ snapshots:
is-docker: 2.2.1
is-wsl: 2.2.0
dependencies:
'@types/node': 18.19.123
'@types/node-fetch': 2.6.13
@@ -24641,7 +24643,6 @@ snapshots:
formdata-node: 4.4.1
node-fetch: 2.7.0
optionalDependencies:
- ws: 8.18.3
zod: 3.25.62
transitivePeerDependencies:
- encoding
@@ -25339,7 +25340,7 @@ snapshots:
optionalDependencies:
'@types/react': 19.2.3
dependencies:
react: 19.2.3
react-dom: 19.2.3([email protected])
diff --git a/web/next.config.mjs b/web/next.config.mjs
index ae7fbca024..0e9c47cf08 100644
--- a/web/next.config.mjs
+++ b/web/next.config.mjs
@@ -67,12 +67,6 @@ const nextConfig = {
turbopack: {
resolveAlias: {
"@langfuse/shared": "./packages/shared/src",
- // this is an ugly hack to get turbopack to work with react-resizable, used in the
- // web/src/features/widgets/components/DashboardGrid.tsx file. This **only** affects
- // the dev server. The CSS is included in the non-turbopack based prod build anyways.
- // Also not needed for the non-turbopack based dev server.
- "react-resizable/css/styles.css":
- "../node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/react-resizable/css/styles.css",
},
},
experimental: {
diff --git a/web/package.json b/web/package.json
index 31d48052f2..31f5718594 100644
--- a/web/package.json
+++ b/web/package.json
@@ -148,7 +148,7 @@
"react-hook-form": "^7.62.0",
"react-icons": "^5.5.0",
"react-markdown": "^10.1.0",
- "react-resizable-panels": "^3.0.6",
+ "react-resizable-panels": "^4.6.5",
"react-responsive": "^10.0.1",
"react18-json-view": "^0.2.8-canary.6",
"recharts": "^2.15.2",
diff --git a/web/src/components/layouts/ResizableDesktopLayout.tsx b/web/src/components/layouts/ResizableDesktopLayout.tsx
index a1aa26b721..cea4545a48 100644
--- a/web/src/components/layouts/ResizableDesktopLayout.tsx
+++ b/web/src/components/layouts/ResizableDesktopLayout.tsx
@@ -1,9 +1,10 @@
-import { type ReactNode, useLayoutEffect, useRef } from "react";
+import { type ReactNode, useId, useLayoutEffect } from "react";
import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
- type ImperativePanelHandle,
+ useDefaultLayout,
+ usePanelRef,
} from "@/src/components/ui/resizable";
interface ResizableDesktopLayoutProps {
@@ -14,11 +15,19 @@ interface ResizableDesktopLayoutProps {
defaultSidebarSize?: number;
minMainSize?: number;
maxSidebarSize?: number;
- autoSaveId?: string;
className?: string;
sidebarPosition?: "left" | "right";
+ persistId?: string;
}
+const MAIN_PANEL_ID = "main";
+const SIDEBAR_PANEL_ID = "sidebar";
+
+const NOOP_LAYOUT_STORAGE = {
+ getItem: () => null,
+ setItem: () => {},
+};
+
/**
* Reusable component to show/hide resizable panels with a consistent DOM tree.
* Always renders the same DOM tree to prevent remounting children and preserve their state.
@@ -31,49 +40,79 @@ export function ResizableDesktopLayout({
defaultSidebarSize = 30,
minMainSize = 30,
maxSidebarSize = 60,
- autoSaveId,
className = "flex h-full w-full",
sidebarPosition = "right",
+ persistId,
}: ResizableDesktopLayoutProps) {
- const sidebarPanelRef = useRef<ImperativePanelHandle>(null);
- const mainPanelRef = useRef<ImperativePanelHandle>(null);
+ const instanceId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
+ const groupId = persistId
+ ? `resizable-layout-${persistId}`
+ : `resizable-layout-${instanceId}`;
+
+ const storage =
+ persistId && typeof window !== "undefined"
+ ? sessionStorage
+ : NOOP_LAYOUT_STORAGE;
+
+ const panelIds =
+ sidebarPosition === "left"
+ ? [SIDEBAR_PANEL_ID, MAIN_PANEL_ID]
+ : [MAIN_PANEL_ID, SIDEBAR_PANEL_ID];
+
+ const { defaultLayout, onLayoutChanged } = useDefaultLayout({
+ id: groupId,
+ panelIds,
+ storage,
+ });
+
+ const sidebarPanelRef = usePanelRef();
useLayoutEffect(() => {
+ const panel = sidebarPanelRef.current;
+ if (!panel) return;
+
if (open) {
- sidebarPanelRef.current?.resize(defaultSidebarSize);
- mainPanelRef.current?.resize(defaultMainSize);
+ // v4 react-resizable-panel `expand()` depends on internal collapsed bookkeeping.
+ // Fallback to default size if the panel remains effectively closed.
+ if (panel.isCollapsed()) {
+ panel.expand();
+ }
+ if (panel.getSize().asPercentage < 2) {
+ panel.resize(`${defaultSidebarSize}%`);
+ }
} else {
- sidebarPanelRef.current?.resize(0);
- mainPanelRef.current?.resize(100);
+ panel.collapse();
}
- }, [open, defaultMainSize, defaultSidebarSize]);
+ }, [open, sidebarPanelRef, defaultSidebarSize]);
return (
<ResizablePanelGroup
- direction="horizontal"
+ id={groupId}
+ orientation="horizontal"
className={className}
- autoSaveId={autoSaveId}
- storage={autoSaveId ? sessionStorage : undefined}
+ defaultLayout={defaultLayout}
+ onLayoutChanged={persistId ? onLayoutChanged : undefined}
>
{sidebarPosition === "left" && (
<ResizablePanel
- ref={sidebarPanelRef}
- defaultSize={0}
- minSize={0}
- maxSize={maxSidebarSize}
+ id={SIDEBAR_PANEL_ID}
+ panelRef={sidebarPanelRef}
+ defaultSize={`${defaultSidebarSize}%`}
+ minSize="0%"
+ maxSize={`${maxSidebarSize}%`}
collapsible={true}
- collapsedSize={0}
+ collapsedSize="0%"
className={open ? "visible" : "invisible"}
style={{ overscrollBehaviorY: "none" }}
>
{sidebarContent}
</ResizablePanel>
)}
- {open && <ResizableHandle withHandle />}
+ {sidebarPosition === "left" && open && <ResizableHandle withHandle />}
<ResizablePanel
- ref={mainPanelRef}
- defaultSize={defaultMainSize}
- minSize={minMainSize}
+ id={MAIN_PANEL_ID}
+ defaultSize={`${defaultMainSize}%`}
+ minSize={`${minMainSize}%`}
>
<div
className="relative h-full w-full overflow-scroll"
@@ -82,14 +121,16 @@ export function ResizableDesktopLayout({
{mainContent}
</div>
</ResizablePanel>
+ {sidebarPosition === "right" && open && <ResizableHandle withHandle />}
{sidebarPosition === "right" && (
<ResizablePanel
- ref={sidebarPanelRef}
- defaultSize={0}
- minSize={0}
- maxSize={maxSidebarSize}
+ id={SIDEBAR_PANEL_ID}
+ panelRef={sidebarPanelRef}
+ defaultSize={`${defaultSidebarSize}%`}
+ minSize="0%"
+ maxSize={`${maxSidebarSize}%`}
collapsible={true}
- collapsedSize={0}
+ collapsedSize="0%"
className={open ? "visible" : "invisible"}
style={{ overscrollBehaviorY: "none" }}
>
diff --git a/web/src/components/table/resizable-filter-layout.tsx b/web/src/components/table/resizable-filter-layout.tsx
index 7ff57e272f..e0dff1a20b 100644
--- a/web/src/components/table/resizable-filter-layout.tsx
+++ b/web/src/components/table/resizable-filter-layout.tsx
@@ -38,8 +38,6 @@ export function ResizableFilterLayout({ children }: PropsWithChildren) {
);
}
- const autoSaveId = tableName ? `filter-layout-${tableName}` : "filter-layout";
-
return (
<ResizableDesktopLayout
mainContent={
@@ -53,8 +51,8 @@ export function ResizableFilterLayout({ children }: PropsWithChildren) {
defaultSidebarSize={filterDefault}
minMainSize={50}
maxSidebarSize={50}
- autoSaveId={autoSaveId}
sidebarPosition="left"
+ persistId={tableName ? `filter-layout-${tableName}` : "filter-layout"}
/>
);
}
diff --git a/web/src/components/table/use-cases/observations.tsx b/web/src/components/table/use-cases/observations.tsx
index c38dd0abfc..24e4f4d239 100644
--- a/web/src/components/table/use-cases/observations.tsx
+++ b/web/src/components/table/use-cases/observations.tsx
@@ -1279,7 +1279,7 @@ export default function ObservationsTable({
}, [generations]);
return (
- <DataTableControlsProvider>
+ <DataTableControlsProvider tableName={observationFilterConfig.tableName}>
<div className="flex h-full w-full flex-col">
{/* Toolbar spanning full width */}
{!hideControls && (
diff --git a/web/src/components/table/use-cases/sessions.tsx b/web/src/components/table/use-cases/sessions.tsx
index c0c2e92c48..a9864436f5 100644
--- a/web/src/components/table/use-cases/sessions.tsx
+++ b/web/src/components/table/use-cases/sessions.tsx
@@ -755,7 +755,7 @@ export default function SessionsTable({
});
return (
- <DataTableControlsProvider>
+ <DataTableControlsProvider tableName={sessionFilterConfig.tableName}>
<div className="flex h-full w-full flex-col">
{/* Toolbar spanning full width */}
<DataTableToolbar
diff --git a/web/src/components/table/use-cases/traces.tsx b/web/src/components/table/use-cases/traces.tsx
index 0d9f096743..474c7485bc 100644
--- a/web/src/components/table/use-cases/traces.tsx
+++ b/web/src/components/table/use-cases/traces.tsx
@@ -1296,7 +1296,7 @@ export default function TracesTable({
}, [traces.isSuccess, traceRowData?.rows]);
return (
- <DataTableControlsProvider>
+ <DataTableControlsProvider tableName={traceFilterConfig.tableName}>
<div className="flex h-full w-full flex-col">
{/* Toolbar spanning full width */}
{!hideControls && (
diff --git a/web/src/components/trace2/components/_layout/TraceLayoutDesktop.tsx b/web/src/components/trace2/components/_layout/TraceLayoutDesktop.tsx
index 691ab7dd03..a116b399fb 100644
--- a/web/src/components/trace2/components/_layout/TraceLayoutDesktop.tsx
+++ b/web/src/components/trace2/components/_layout/TraceLayoutDesktop.tsx
@@ -1,15 +1,15 @@
import { StringParam, useQueryParam } from "use-query-params";
import {
- PanelGroup,
- PanelResizeHandle,
+ Group,
+ Separator,
Panel,
- type ImperativePanelHandle,
+ usePanelRef,
+ useDefaultLayout,
+ type PanelImperativeHandle,
} from "react-resizable-panels";
import {
- useRef,
useState,
useEffect,
- useLayoutEffect,
createContext,
useContext,
type ReactNode,
@@ -20,17 +20,11 @@ const RESIZABLE_PANEL_HANDLE_ID = "trace-layout-handle";
const RESIZABLE_PANEL_NAVIGATION_ID = "trace-layout-panel-navigation";
const RESIZABLE_PANEL_PREVIEW_ID = "trace-layout-panel-preview";
-const NAVIGATION_PANEL_DEFAULT_SIZE_IN_PIXELS = 450;
-const NAVIGATION_PANEL_MIN_SIZE_IN_PIXELS = 360;
-const NAVIGATION_PANEL_COLLAPSED_SIZE_IN_PIXELS = 40;
-
// Context for sharing panel state with compound components
interface TraceLayoutDesktopContext {
- navigationPanelMinSize: number;
- navigationPanelCollapsedSize: number;
isNavigationPanelCollapsed: boolean;
setIsNavigationPanelCollapsed: (collapsed: boolean) => void;
- panelRef: React.RefObject<ImperativePanelHandle | null>;
+ panelRef: React.RefObject<PanelImperativeHandle | null>;
handleTogglePanel: () => void;
shouldPulseToggle: boolean;
}
@@ -57,84 +51,20 @@ export function TraceLayoutDesktop({ children }: { children: ReactNode }) {
const [viewMode] = useQueryParam("view", StringParam);
const isTimelineView = viewMode === "timeline";
- // react-resizable-panels requires percentage values
- const [navigationPanelDefaultSize, setNavigationPanelDefaultSize] =
- useState(10);
- const [navigationPanelMinSize, setNavigationPanelMinSize] = useState(10);
- const [navigationPanelCollapsedSize, setNavigationPanelCollapsedSize] =
- useState(5);
const [isNavigationPanelCollapsed, setIsNavigationPanelCollapsed] =
useState(false);
- // Remember the last size before collapse to restore it when expanding
- const [lastNavigationPanelSize, setLastNavigationPanelSize] = useState<
- number | null
- >(null);
-
// Ref to programmatically control the panel
- const panelRef = useRef<ImperativePanelHandle>(null);
-
- useLayoutEffect(() => {
- // Note: react-resizable-panels does not support pixel-based values
- // this is a workaround to get the correct values
- const panelGroup = document.querySelector(
- `#${RESIZABLE_PANEL_GROUP_ID}`,
- ) as HTMLElement;
- const resizeHandles = document.querySelectorAll(
- `#${RESIZABLE_PANEL_HANDLE_ID}`,
- ) as NodeListOf<HTMLElement>;
-
- if (!panelGroup || !resizeHandles) {
- return;
- }
-
- const observer = new ResizeObserver(() => {
- // For horizontal panels, we need to use width, not height
- let width = panelGroup.offsetWidth;
-
- // Subtract the width of resize handles
- resizeHandles.forEach((resizeHandle) => {
- width -= resizeHandle.offsetWidth;
- });
-
- // Convert pixel values to percentages based on available width
- const defaultSizePercentage =
- (NAVIGATION_PANEL_DEFAULT_SIZE_IN_PIXELS / width) * 100;
- const minSizePercentage =
- (NAVIGATION_PANEL_MIN_SIZE_IN_PIXELS / width) * 100;
- const collapsedSizePercentage =
- (NAVIGATION_PANEL_COLLAPSED_SIZE_IN_PIXELS / width) * 100;
-
- setNavigationPanelDefaultSize(defaultSizePercentage);
- setNavigationPanelMinSize(minSizePercentage);
- setNavigationPanelCollapsedSize(collapsedSizePercentage);
- });
- observer.observe(panelGroup);
-
- resizeHandles.forEach((resizeHandle) => {
- observer.observe(resizeHandle);
- });
-
- return () => {
- observer.disconnect();
- };
- }, []);
+ const panelRef = usePanelRef();
+ // v4 has built-in collapse()/expand() that remembers last size
const handleTogglePanel = () => {
if (!panelRef.current) return;
- // Programmatically collapse or expand the panel
- if (isNavigationPanelCollapsed) {
- // Expanding: restore to last size or use defaultSize as fallback
- const targetSize = lastNavigationPanelSize ?? navigationPanelDefaultSize;
- panelRef.current.resize(targetSize);
- setIsNavigationPanelCollapsed(false);
+ if (panelRef.current.isCollapsed()) {
+ panelRef.current.expand();
} else {
- // Collapsing: save current size before collapsing
- const currentSize = panelRef.current.getSize();
- setLastNavigationPanelSize(currentSize);
- setIsNavigationPanelCollapsed(true);
- panelRef.current.resize(navigationPanelCollapsedSize);
+ panelRef.current.collapse();
}
};
@@ -154,9 +84,13 @@ export function TraceLayoutDesktop({ children }: { children: ReactNode }) {
}
}, [isTimelineView]);
+ const { defaultLayout, onLayoutChanged } = useDefaultLayout({
+ id: RESIZABLE_PANEL_GROUP_ID,
+ panelIds: [RESIZABLE_PANEL_NAVIGATION_ID, RESIZABLE_PANEL_PREVIEW_ID],
+ storage: sessionStorage,
+ });
+
const contextValue: TraceLayoutDesktopContext = {
- navigationPanelMinSize,
- navigationPanelCollapsedSize,
isNavigationPanelCollapsed,
setIsNavigationPanelCollapsed,
panelRef,
@@ -167,9 +101,14 @@ export function TraceLayoutDesktop({ children }: { children: ReactNode }) {
return (
<LayoutContext.Provider value={contextValue}>
<div className="h-full w-full">
- <PanelGroup direction="horizontal" id={RESIZABLE_PANEL_GROUP_ID}>
+ <Group
+ orientation="horizontal"
+ id={RESIZABLE_PANEL_GROUP_ID}
+ defaultLayout={defaultLayout}
+ onLayoutChanged={onLayoutChanged}
+ >
{children}
- </PanelGroup>
+ </Group>
</div>
</LayoutContext.Provider>
);
@@ -181,22 +120,19 @@ TraceLayoutDesktop.NavigationPanel = function Navigation({
}: {
children: ReactNode;
}) {
- const {
- navigationPanelMinSize,
- navigationPanelCollapsedSize,
- setIsNavigationPanelCollapsed,
- panelRef,
- } = useLayoutContext();
+ const { setIsNavigationPanelCollapsed, panelRef } = useLayoutContext();
return (
<Panel
id={RESIZABLE_PANEL_NAVIGATION_ID}
- ref={panelRef}
+ panelRef={panelRef}
collapsible={true}
- collapsedSize={navigationPanelCollapsedSize}
- minSize={navigationPanelMinSize}
- onCollapse={() => setIsNavigationPanelCollapsed(true)}
- onExpand={() => setIsNavigationPanelCollapsed(false)}
+ collapsedSize="40px"
+ minSize="260px"
+ defaultSize="450px"
+ onResize={() => {
+ setIsNavigationPanelCollapsed(panelRef.current?.isCollapsed() ?? false);
+ }}
>
{children}
</Panel>
@@ -208,9 +144,9 @@ TraceLayoutDesktop.ResizeHandle = function ResizeHandle() {
const { handleTogglePanel } = useLayoutContext();
return (
- <PanelResizeHandle
+ <Separator
id={RESIZABLE_PANEL_HANDLE_ID}
- className="relative w-px bg-border transition-colors duration-200 after:absolute after:inset-y-0 after:left-0 after:w-1 after:bg-blue-200 after:opacity-0 after:transition-opacity after:duration-200 hover:after:opacity-100 data-[resize-handle-state='drag']:after:opacity-100"
+ className="relative w-px bg-border transition-colors duration-200 after:absolute after:inset-y-0 after:left-0 after:w-1 after:bg-blue-200 after:opacity-0 after:transition-opacity after:duration-200 hover:after:opacity-100 active:after:opacity-100"
onDoubleClick={handleTogglePanel}
/>
);
@@ -223,7 +159,7 @@ TraceLayoutDesktop.DetailPanel = function Detail({
children: ReactNode;
}) {
return (
- <Panel id={RESIZABLE_PANEL_PREVIEW_ID} defaultSize={70} minSize={50}>
+ <Panel id={RESIZABLE_PANEL_PREVIEW_ID} defaultSize="70%" minSize="50%">
{children}
</Panel>
);
diff --git a/web/src/components/trace2/components/_layout/TracePanelNavigationLayoutDesktop.tsx b/web/src/components/trace2/components/_layout/TracePanelNavigationLayoutDesktop.tsx
index 7c614fa776..6860573516 100644
--- a/web/src/components/trace2/components/_layout/TracePanelNavigationLayoutDesktop.tsx
+++ b/web/src/components/trace2/components/_layout/TracePanelNavigationLayoutDesktop.tsx
@@ -50,14 +50,14 @@ export function TracePanelNavigationLayoutDesktop({
<TracePanelNavigationHiddenNotice />
{secondaryContent ? (
<ResizablePanelGroup
- direction="vertical"
+ orientation="vertical"
className="flex-1 overflow-hidden"
>
- <ResizablePanel defaultSize={60} minSize={20}>
+ <ResizablePanel defaultSize="60%" minSize="20%">
<div className="h-full overflow-hidden">{children}</div>
</ResizablePanel>
<ResizableHandle className="h-px bg-border" />
- <ResizablePanel defaultSize={40} minSize={20}>
+ <ResizablePanel defaultSize="40%" minSize="20%">
<div className="h-full overflow-hidden">{secondaryContent}</div>
</ResizablePanel>
</ResizablePanelGroup>
diff --git a/web/src/components/ui/resizable.tsx b/web/src/components/ui/resizable.tsx
index 0a37a87ff0..fb55a92121 100644
--- a/web/src/components/ui/resizable.tsx
+++ b/web/src/components/ui/resizable.tsx
@@ -1,46 +1,63 @@
"use client";
-import { GripVertical } from "lucide-react";
import * as ResizablePrimitive from "react-resizable-panels";
import { cn } from "@/src/utils/tailwind";
-const ResizablePanelGroup = ({
+function ResizablePanelGroup({
className,
+ orientation,
...props
-}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (
- <ResizablePrimitive.PanelGroup
- className={cn(
- "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
- className,
- )}
- {...props}
- />
-);
+}: ResizablePrimitive.GroupProps) {
+ return (
+ <ResizablePrimitive.Group
+ data-slot="resizable-panel-group"
+ className={cn(
+ "flex h-full w-full aria-[orientation=vertical]:flex-col",
+ className,
+ )}
+ orientation={orientation}
+ {...props}
+ />
+ );
+}
-const ResizablePanel = ResizablePrimitive.Panel;
+function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
+ return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />;
+}
-const ResizableHandle = ({
+function ResizableHandle({
withHandle,
className,
...props
-}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
+}: ResizablePrimitive.SeparatorProps & {
withHandle?: boolean;
-}) => (
- <ResizablePrimitive.PanelResizeHandle
- className={cn(
- "relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
- className,
- )}
- {...props}
- >
- {withHandle && (
- <div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border">
- <GripVertical className="h-2.5 w-2.5" />
- </div>
- )}
- </ResizablePrimitive.PanelResizeHandle>
-);
+}) {
+ return (
+ <ResizablePrimitive.Separator
+ data-slot="resizable-handle"
+ className={cn(
+ "focus-visible:outline-hidden relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:-translate-y-1/2 aria-[orientation=horizontal]:after:translate-x-0 [&[aria-orientation=horizontal]>div]:rotate-90",
+ className,
+ )}
+ {...props}
+ >
+ {withHandle && (
+ <div className="z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border" />
+ )}
+ </ResizablePrimitive.Separator>
+ );
+}
-export { ResizablePanelGroup, ResizablePanel, ResizableHandle };
-export type { ImperativePanelHandle } from "react-resizable-panels";
+const usePanelRef = ResizablePrimitive.usePanelRef;
+const useDefaultLayout = ResizablePrimitive.useDefaultLayout;
+
+export {
+ ResizableHandle,
+ ResizablePanel,
+ ResizablePanelGroup,
+ usePanelRef,
+ useDefaultLayout,
+};
+type ImperativePanelHandle = ResizablePrimitive.PanelImperativeHandle;
+export type { ImperativePanelHandle };
diff --git a/web/src/features/annotation-queues/components/shared/AnnotationProcessingLayout.tsx b/web/src/features/annotation-queues/components/shared/AnnotationProcessingLayout.tsx
index c2f43913e9..dfdc39c06f 100644
--- a/web/src/features/annotation-queues/components/shared/AnnotationProcessingLayout.tsx
+++ b/web/src/features/annotation-queues/components/shared/AnnotationProcessingLayout.tsx
@@ -32,23 +32,25 @@ export const AnnotationProcessingLayout: React.FC<
{/* Desktop: Horizontal resizable panels */}
<div className="hidden max-h-full min-h-0 overflow-hidden md:block">
<ResizablePanelGroup
- direction="horizontal"
+ orientation="horizontal"
className="h-full overflow-hidden"
- onLayout={(sizes) => {
- setPanelSize(sizes[0]);
+ onLayoutChanged={(layout) => {
+ const left = layout["annotation-left"];
+ if (left != null) setPanelSize(left);
}}
>
<ResizablePanel
+ id="annotation-left"
className="col-span-1 h-full !overflow-y-auto rounded-md border"
- minSize={30}
- defaultSize={panelSize}
+ minSize="30%"
+ defaultSize={`${panelSize}%`}
>
{leftPanel}
</ResizablePanel>
<ResizableHandle withHandle className="ml-4 bg-transparent" />
<ResizablePanel
className="col-span-1 flex h-full flex-col overflow-hidden"
- minSize={30}
+ minSize="30%"
>
{rightPanel}
</ResizablePanel>
diff --git a/web/src/features/datasets/components/AnnotationPanel.tsx b/web/src/features/datasets/components/AnnotationPanel.tsx
index 8daffd442e..6c19e0b1e5 100644
--- a/web/src/features/datasets/components/AnnotationPanel.tsx
+++ b/web/src/features/datasets/components/AnnotationPanel.tsx
@@ -36,14 +36,18 @@ export const AnnotationPanel = ({ projectId }: { projectId: string }) => {
return (
<ResizablePanelGroup
- direction="vertical"
- onLayout={(sizes) => setVerticalSize(sizes[0])}
+ orientation="vertical"
className="h-full"
+ onLayoutChanged={(layout) => {
+ const top = layout["annotation-top"];
+ if (top != null) setVerticalSize(top);
+ }}
>
<ResizablePanel
+ id="annotation-top"
className="w-full overflow-y-auto p-2"
- minSize={30}
- defaultSize={verticalSize}
+ minSize="30%"
+ defaultSize={`${verticalSize}%`}
>
{activeCell ? (
<>
@@ -91,7 +95,7 @@ export const AnnotationPanel = ({ projectId }: { projectId: string }) => {
)}
</ResizablePanel>
<ResizableHandle withHandle />
- <ResizablePanel className="overflow-y-auto" minSize={20}>
+ <ResizablePanel className="overflow-y-auto" minSize="20%">
<CommentsSection
projectId={projectId}
objectId={activeCell.observationId ?? activeCell.traceId}
diff --git a/web/src/features/datasets/components/DatasetRunsTable.tsx b/web/src/features/datasets/components/DatasetRunsTable.tsx
index d4e72bcc8e..7a188e53b0 100644
--- a/web/src/features/datasets/components/DatasetRunsTable.tsx
+++ b/web/src/features/datasets/components/DatasetRunsTable.tsx
@@ -601,15 +601,17 @@ export function DatasetRunsTable(props: {
<>
{hasCharts ? (
<ResizablePanelGroup
- direction="vertical"
+ orientation="vertical"
className="h-full"
- onLayout={(sizes) => {
- setChartsPanelSize(sizes[0]);
+ onLayoutChanged={(layout) => {
+ const charts = layout["dataset-charts"];
+ if (charts != null) setChartsPanelSize(charts);
}}
>
<ResizablePanel
- defaultSize={chartsPanelSize}
- minSize={20}
+ id="dataset-charts"
+ defaultSize={`${chartsPanelSize}%`}
+ minSize="20%"
className="overflow-hidden"
>
<div className="h-full w-full overflow-x-auto overflow-y-auto p-3">
@@ -712,7 +714,7 @@ export function DatasetRunsTable(props: {
</ResizablePanel>
<ResizableHandle withHandle className="bg-border" />
<ResizablePanel
- minSize={40}
+ minSize="40%"
className="flex h-full flex-1 flex-col overflow-hidden"
>
<DataTableToolbar
diff --git a/web/src/features/events/components/EventsTable.tsx b/web/src/features/events/components/EventsTable.tsx
index 4112a84623..8b42e0bc98 100644
--- a/web/src/features/events/components/EventsTable.tsx
+++ b/web/src/features/events/components/EventsTable.tsx
@@ -1227,7 +1227,9 @@ export default function ObservationsEventsTable({
}, [selectedObservationIds, observations.rows]);
return (
- <DataTableControlsProvider>
+ <DataTableControlsProvider
+ tableName={observationEventsFilterConfig.tableName}
+ >
<div className="flex h-full w-full flex-col">
{/* Toolbar spanning full width */}
{!hideControls && (
diff --git a/web/src/features/playground/page/components/Messages.tsx b/web/src/features/playground/page/components/Messages.tsx
index 7cfd422f5c..7434597d7b 100644
--- a/web/src/features/playground/page/components/Messages.tsx
+++ b/web/src/features/playground/page/components/Messages.tsx
@@ -23,14 +23,14 @@ import {
export const Messages: React.FC<MessagesContext> = (props) => {
return (
<div className="flex h-full flex-col space-y-4 pr-4 pt-2">
- <ResizablePanelGroup direction="vertical">
- <ResizablePanel minSize={10}>
+ <ResizablePanelGroup orientation="vertical">
+ <ResizablePanel minSize="10%">
<ChatMessages {...props} />
</ResizablePanel>
<ResizableHandle withHandle className="bg-transparent" />
<ResizablePanel
- minSize={20}
- defaultSize={20}
+ minSize="20%"
+ defaultSize="20%"
className="flex flex-col space-y-4"
>
<GenerationOutput />
diff --git a/web/src/features/playground/page/context/index.tsx b/web/src/features/playground/page/context/index.tsx
index 47e0a3826c..eed88ee888 100644
--- a/web/src/features/playground/page/context/index.tsx
+++ b/web/src/features/playground/page/context/index.tsx
@@ -366,6 +366,7 @@ export const PlaygroundProvider: React.FC<PlaygroundProviderProps> = ({
setOutput(displayContent);
setOutputToolCalls(completion.tool_calls);
+ if (completion.reasoning) setOutputReasoning(completion.reasoning);
response = JSON.stringify(completion, null, 2);
} else if (structuredOutputSchema) {
@@ -710,7 +711,7 @@ async function getChatCompletionWithTools(
modelParams: UIModelParams,
tools: unknown[],
streaming: boolean = false,
-): Promise<ToolCallResponse> {
+): Promise<ToolCallResponse & { reasoning?: string }> {
if (!projectId) throw Error("Project ID is not set");
const body = JSON.stringify({
@@ -743,7 +744,10 @@ async function getChatCompletionWithTools(
JSON.stringify(responseData, null, 2),
);
- return parsed.data;
+ return {
+ ...parsed.data,
+ ...(responseData.reasoning ? { reasoning: responseData.reasoning } : {}),
+ };
}
async function getChatCompletionWithStructuredOutput(