Fix sidebar resize limit after window growth#4482
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:
✨ Finishing Touches🧪 Generate unit tests (beta)
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: Needs human review Bug fix for sidebar resize behavior introduces new runtime event listeners and API options to a shared component. External contributor with no prior commits to this repository (labeled 'vouch:unvouched'). You can customize Macroscope's approvability policy. Learn more. |
233e5db to
8e3f616
Compare
8e3f616 to
15fe789
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 15fe789. Configure here.
081e832 to
ea0cea1
Compare

What Changed
Why
The sidebar maximum was calculated only during render from the initial window width. If a restored or resized window became wider without another relevant render, the resize rail retained the old cap and could not use the newly available space.
UI Changes
Behavioral only; there are no visual styling changes. In a controlled browser, a stored 900px sidebar correctly clamped to 360px at a 1000px viewport, then returned to 900px when the viewport grew to 1600px, leaving 700px for main content. The collaborative preview screenshot and recording endpoints timed out, so no media is attached.
Validation
vp test run --project unit src/components/threadSidebarWidth.test.ts(from apps/web)vp fmt --check apps/web/src/components/AppSidebarLayout.tsx apps/web/src/components/threadSidebarWidth.test.tsvp lint apps/web/src/components/AppSidebarLayout.tsx apps/web/src/components/threadSidebarWidth.test.tsgit diff --checkChecklist
Note
Low Risk
Layout-only sidebar sizing and localStorage width persistence; no auth, data, or API changes.
Overview
Fixes the thread sidebar staying capped at the initial window width after the viewport grows, so drag-resize could not reclaim space even when a wide preference was stored.
AppSidebarLayoutnow drives--sidebar-widththroughresolveThreadSidebarCssWidth(a livemin/max/calc(100vw …)expression) and passes amaxWidthcallback that readswindow.innerWidthon each clamp during rail resize. Initial load reads storage with only min/default handling (hydrateStoredWidth: falseon the sharedSidebarso hydration stays in the layout).The shared
Sidebarrail gains optionalgetCssWidthandhydrateStoredWidth, function-valuedmaxWidth, clamp helpers, commit-time CSS updates viagetCssWidth, persisting the clamped width, andonResize(storedWidth)on hydrate so the numeric preference is not lost when the viewport is temporarily narrow. Aresizelistener briefly disables width transitions to avoid glitches when the CSS clamp adjusts.Reviewed by Cursor Bugbot for commit ea0cea1. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix sidebar resize limit to respect window growth after viewport expansion
maxWidthis resolved dynamically per-resize viawindow.innerWidth.resolveThreadSidebarCssWidthandresolveSidebarCssWidthhelpers that express sidebar width as a CSSmin/maxexpression, so the sidebar clamps live in CSS instead of only at resize commit time.hydrateStoredWidthcan be disabled on theSidebarcomponent, with the caller (AppSidebarLayout) managing its own hydration.readInitialThreadSidebarWidthno longer clamps to the viewport at read time; it clamps only toTHREAD_SIDEBAR_MIN_WIDTHand falls back toTHREAD_SIDEBAR_DEFAULT_WIDTH.Macroscope summarized ea0cea1.