Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions frontend/src/renderer/components/SessionView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef, useState } from "react";
import { useCallback, useEffect, useRef, useState } from "react";
import { useNavigate } from "@tanstack/react-router";
import type { PanelImperativeHandle, PanelSize } from "react-resizable-panels";
import { CenterPane } from "./CenterPane";
Expand Down Expand Up @@ -96,15 +96,22 @@ export function SessionView({ sessionId, projectId }: SessionViewProps) {

// Persist drags and mirror collapse state (dragging past minSize collapses)
// back into the store. Read the store imperatively to avoid a stale closure.
const handleInspectorResize = (size: PanelSize) => {
const open = useUiStore.getState().isInspectorOpen;
if (size.asPercentage > 0) {
window.localStorage?.setItem(inspectorSplitStorageKey, String(size.asPercentage));
if (!open) toggleInspector();
} else if (open) {
toggleInspector();
}
};
// Wrapped in useCallback so rrp v4's panel registration useLayoutEffect (which
// includes onResize in its dep array) does not de-register/re-register the
// inspector panel on every render — preventing the "Panel constraints not found
// for Panel inspector" race with the expand()/collapse() effect above.
const handleInspectorResize = useCallback(
(size: PanelSize) => {
const open = useUiStore.getState().isInspectorOpen;
if (size.asPercentage > 0) {
window.localStorage?.setItem(inspectorSplitStorageKey, String(size.asPercentage));
if (!open) toggleInspector();
} else if (open) {
toggleInspector();
}
},
[toggleInspector],
);

if (!session && !workspaceQuery.isLoading) {
return (
Expand Down
Loading