fix: allow sidebar to be shrunk when wider than viewport#2456
fix: allow sidebar to be shrunk when wider than viewport#2456shoaib050326 wants to merge 1 commit intopingdotgg:mainfrom
Conversation
When the window is restored to a small size after expanding the sidebar while maximized, the sidebar width can exceed the viewport width. The shouldAcceptWidth guard wrapper.clientWidth - nextWidth >= 640 becomes negative and blocks ALL resize attempts — even shrinking — creating a permanent deadlock. Fix: always accept the resize when nextWidth <= currentWidth (user is making the sidebar smaller). The >= 640 constraint only applies when expanding. Closes pingdotgg#2339
|
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 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: Approved Straightforward UI bug fix that adds a condition to allow shrinking a sidebar that was previously too wide. The change is minimal, self-contained, and has clear intent with no security or infrastructure implications. You can customize Macroscope's approvability policy. Learn more. |
Summary
nextWidth <= currentWidth), fixing a deadlock where the sidebar becomes permanently stuck when the window is restored to a smaller size after being maximized.Root Cause
shouldAcceptWidthinAppSidebarLayout.tsxevaluatedwrapper.clientWidth - nextWidth >= 640for every drag step. When the sidebar width exceeds the viewport width (e.g. sidebar expanded while maximized, then window restored to small size), this expression is negative, blocking ALL resize attempts — even shrinking — creating a permanent deadlock.Fix
currentWidthis already provided by the caller (sidebar.tsx:480) but was previously unused.Risk
Low. One-line logic change in a single callback. Rollback is a one-line revert.
Closes #2339
Note
Low Risk
Low risk: a small change to the sidebar resize acceptance predicate that only relaxes constraints when shrinking; expansion behavior still enforces the minimum main-content width.
Overview
Prevents the thread sidebar from getting stuck at an oversized width after the window is resized smaller by updating
AppSidebarLayout’sresizable.shouldAcceptWidth.Shrinking (
nextWidth <= currentWidth) is now always accepted, while expanding still requires enough remaining space to satisfy theTHREAD_MAIN_CONTENT_MIN_WIDTHconstraint.Reviewed by Cursor Bugbot for commit 8d8c62b. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix sidebar shrinking when wider than the viewport
Previously, the sidebar resize logic in AppSidebarLayout.tsx only accepted a new width if the remaining main content met
THREAD_MAIN_CONTENT_MIN_WIDTH, which blocked shrinking when the sidebar was wider than the viewport. TheshouldAcceptWidthcallback now also accepts any width decrease unconditionally, so shrinking always works regardless of viewport size.Macroscope summarized 8d8c62b.