Skip to content

fix: allow sidebar to be shrunk when wider than viewport#2456

Open
shoaib050326 wants to merge 1 commit intopingdotgg:mainfrom
shoaib050326:fix/sidebar-resize-deadlock-2339
Open

fix: allow sidebar to be shrunk when wider than viewport#2456
shoaib050326 wants to merge 1 commit intopingdotgg:mainfrom
shoaib050326:fix/sidebar-resize-deadlock-2339

Conversation

@shoaib050326
Copy link
Copy Markdown

@shoaib050326 shoaib050326 commented May 2, 2026

Summary

  • Always accept sidebar resize when user is shrinking (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

shouldAcceptWidth in AppSidebarLayout.tsx evaluated wrapper.clientWidth - nextWidth >= 640 for 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

-  shouldAcceptWidth: ({ nextWidth, wrapper }) =>
-    wrapper.clientWidth - nextWidth >= THREAD_MAIN_CONTENT_MIN_WIDTH,
+  shouldAcceptWidth: ({ currentWidth, nextWidth, wrapper }) =>
+    nextWidth <= currentWidth ||
+    wrapper.clientWidth - nextWidth >= THREAD_MAIN_CONTENT_MIN_WIDTH,
  • currentWidth is already provided by the caller (sidebar.tsx:480) but was previously unused.
  • Shrinking is always accepted. Expansion still enforces the 640px main-content minimum.

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’s resizable.shouldAcceptWidth.

Shrinking (nextWidth <= currentWidth) is now always accepted, while expanding still requires enough remaining space to satisfy the THREAD_MAIN_CONTENT_MIN_WIDTH constraint.

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. The shouldAcceptWidth callback now also accepts any width decrease unconditionally, so shrinking always works regardless of viewport size.

Macroscope summarized 8d8c62b.

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
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 2, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f2bf9943-4f0a-4d0f-967b-8de05a13d05a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels May 2, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 2, 2026

Approvability

Verdict: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Resizing window to mimumum width while sidebar is expanded causes permanent sidebar deadlock

1 participant