fix(renderer): stabilize onResize ref to prevent rrp constraint race#193
Open
harshitsinghbhandari wants to merge 1 commit into
Open
fix(renderer): stabilize onResize ref to prevent rrp constraint race#193harshitsinghbhandari wants to merge 1 commit into
harshitsinghbhandari wants to merge 1 commit into
Conversation
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>
Contributor
There was a problem hiding this comment.
harshitsinghbhandari has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
handleInspectorResizeinuseCallback([toggleInspector])inSessionView.tsxonResizereference across renders so rrp v4's panel registrationuseLayoutEffectstops de-registering/re-registering the inspector panel on every re-renderRoot Cause (full RCA at #185)
rrp v4's
ResizablePanelincludes theonResizecallback in itsuseLayoutEffectdependency array.handleInspectorResizewas defined withoutuseCallback, so every re-render ofSessionView(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 theexpand()/collapse()useEffecton initial sidebar click, producing the rrp throw.Test plan
pnpm --filter frontend testpasses (vitest; inspector split tests cover the affected path)Closes #185.
🤖 Generated with Claude Code