Skip to content

fix(resizable): fix "Panel constraints not found" error on initial render#20

Merged
bob-obringer merged 1 commit intomainfrom
fix/resizable-panel-constraints-error
Jan 21, 2026
Merged

fix(resizable): fix "Panel constraints not found" error on initial render#20
bob-obringer merged 1 commit intomainfrom
fix/resizable-panel-constraints-error

Conversation

@bob-obringer
Copy link
Collaborator

Summary

Fixes the "Panel constraints not found for Panel r_l" error that occurred when using the collapsed prop on ResizablePanel during initial render.

Root Cause

The error occurred because panelRef.current?.collapse() was called before the panel group had computed its constraints. The previous requestAnimationFrame timing wasn't sufficient.

Changes

  • setTimeout(0) instead of requestAnimationFrame - Ensures we're after the panel group's layout effects
  • Try-catch with retry logic - If the panel isn't ready yet, we retry after another tick
  • No animation on first sync - Initial collapsed state applies instantly (no jarring animation on load)

Test plan

  • Use <ResizablePanel collapsed={true} collapsible> on initial render - no error
  • Toggle collapsed prop after mount - panel collapses/expands correctly
  • With animated prop - subsequent toggles animate smoothly
  • Build passes (yarn build)

🤖 Generated with Claude Code

…nder

The error occurred when using `collapsed` prop because we tried to call
`collapse()` before the panel group had computed its constraints.

Changes:
- Use `setTimeout(0)` instead of `requestAnimationFrame` to ensure we're
  after the panel group's layout effects
- Add try-catch with retry logic for race conditions
- Skip animation on first sync (initial collapsed state)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Jan 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
ui Ready Ready Preview, Comment Jan 21, 2026 3:53am

Request Review

@bob-obringer bob-obringer merged commit 31a53a6 into main Jan 21, 2026
3 checks passed
@bob-obringer bob-obringer deleted the fix/resizable-panel-constraints-error branch January 21, 2026 03:54
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.

1 participant