fix(web): reserve sibling column width when resizing the right panel - #6279
fix(web): reserve sibling column width when resizing the right panel#6279Lasdw6 wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved f6d8dff Straightforward UI bug fix that adds container width measurement to prevent the preview panel from squeezing its sibling column below minimum width. Changes are self-contained to layout constraints with comprehensive test coverage. You can customize Macroscope's approvability policy. Learn more. |
The panel's drag clamp was 70% of window.innerWidth, blind to the app sidebar and the chat column's minimum content width. On viewports under ~1950px (any fullscreen MacBook, or a non-maximized window on Windows) the remaining space fell below what the composer needs, so it overflowed the chat panel before the clamp engaged. Clamp against the panel's flex row instead, minus a 360px reservation for the sibling column, keeping the viewport fraction as a secondary cap. The row measurement excludes the sidebar, reacts to both window and sidebar resizes, happens before first paint so a persisted over-wide width cannot flash on mount, and is skipped entirely in modes that never apply the width (sheet, embedded, maximized). The result is floored at the panel's own minimum so a too-narrow row cannot invert the resize clamp.
871d8ed to
f6ed169
Compare

What Changed
The right panel's (diff/preview) resize clamp now reserves a minimum width for its sibling column (the chat, or the pull-request list) instead of only capping at 70% of
window.innerWidth.getPreviewPanelMaxWidthtakes the panel's flex-row width and clamps torowWidth − 360px, keeping the viewport fraction as a secondary cap and flooring at the panel's own 360px minimum so a too-narrow row cannot invert the resize clamp.measurecallback (before first paint, then via ResizeObserver), so the clamp reacts to window and sidebar resizes and a persisted over-wide width cannot flash on mount. Measurement is skipped in modes that never apply the width (sheet, embedded, maximized).+90/−10 in
PreviewPanelShell.tsxand its test file.Why
Fixes #6181.
The clamp was blind to the app sidebar (which sits outside the 70% math) and to the chat composer's minimum content width. Whenever
0.3 × viewport − sidebarfell below what the composer needs, the composer overflowed the chat panel before the clamp engaged.That threshold is roughly a 1950px viewport, which is why the issue looked macOS-only: every MacBook — even fullscreen at 1512–1728 logical px — is below it, while typical Windows desktop monitors are above it. Reproduced on Windows 11 at non-maximized window widths and on macOS fullscreen; the drag now hard-stops leaving the sibling column usable on both.
UI Changes
Before/after screenshots and drag recordings are in the comment below (macOS fullscreen, matching the issue's environment).
Checklist
Note
Reserve sibling column width when resizing the right preview panel
getPreviewPanelMaxWidthin PreviewPanelShell.tsx to accept an optionalcontainerWidthand subtract aSIBLING_COLUMN_MIN_WIDTH(360px) reservation, so the preview panel cannot grow into the sibling column's space.useViewportClampedMaxWidthhook withuseClampedMaxWidth, which tracks both viewport width and the parent flex-row container width viaResizeObserveranduseLayoutEffectto avoid over-wide flashes on mount.Macroscope summarized f6ed169.
Note
Low Risk
UI-only resize clamp change in the preview panel shell; no auth, data, or security-sensitive logic.
Overview
Stops the inline preview/diff panel from squeezing the sibling chat (or PR list) column on narrower windows by clamping max width to row width − 360px, not just 70% of the viewport.
getPreviewPanelMaxWidthnow takes an optional container width, keeps the viewport fraction as a secondary cap, and floors at the panel’s own 360px minimum so a too-narrow row cannot invertuseResizableWidth’s clamp. The flex row is measured withuseLayoutEffect+ResizeObserver(skipped outside inline non-maximized mode) so window and sidebar resizes re-clamp without an over-wide flash on mount.Reviewed by Cursor Bugbot for commit f6ed169. Bugbot is set up for automated code reviews on this repo. Configure here.