Skip to content

fix(renderer): stabilize onResize ref to prevent rrp constraint race#193

Open
harshitsinghbhandari wants to merge 1 commit into
mainfrom
session/aa-87
Open

fix(renderer): stabilize onResize ref to prevent rrp constraint race#193
harshitsinghbhandari wants to merge 1 commit into
mainfrom
session/aa-87

Conversation

@harshitsinghbhandari

Copy link
Copy Markdown
Collaborator

Summary

  • Wraps handleInspectorResize in useCallback([toggleInspector]) in SessionView.tsx
  • Stabilises the onResize reference across renders so rrp v4's panel registration useLayoutEffect stops de-registering/re-registering the inspector panel on every re-render
  • Eliminates the "Panel constraints not found for Panel inspector" crash that tore down the session view on every sidebar click

Root Cause (full RCA at #185)

rrp v4's ResizablePanel includes the onResize callback in its useLayoutEffect dependency array. handleInspectorResize was defined without useCallback, so every re-render of SessionView (workspace query update, daemon status change, etc.) produced a new function reference → rrp ran cleanup (removed "inspector" from its constraints map) then re-ran the effect (re-added it). With React 19's automatic batching, this cleanup window reliably overlapped with the expand()/collapse() useEffect on initial sidebar click, producing the rrp throw.

Test plan

  • pnpm --filter frontend test passes (vitest; inspector split tests cover the affected path)
  • Launch Electron app, click sessions in the sidebar — no error overlay
  • Toggle inspector open/close with ⌘⇧B — no error

Closes #185.

🤖 Generated with Claude Code

Wrap handleInspectorResize 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.

Without this, any re-render of SessionView (workspace data arriving,
daemon status change, etc.) created a new handleInspectorResize reference,
triggering rrp's cleanup → re-registration cycle. With React 19's automatic
batching, this window reliably overlapped with the expand()/collapse()
useEffect on initial sidebar click, causing the "Panel constraints not found
for Panel inspector" throw that tore down the session view.

Fixes #185.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

harshitsinghbhandari has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: "Panel constraints not found for Panel inspector" error on sidebar panel click

1 participant