feat(sidebar): reset width on double-click with viewport-based default - #6287
feat(sidebar): reset width on double-click with viewport-based default#6287chirivelli wants to merge 3 commits into
Conversation
Double-clicking the resize rail restores the sidebar to 20% of the viewport width and persists the reset preference. Co-authored-by: Cursor <cursoragent@cursor.com>
|
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 |
Wrap setLocalStorageItem in try/catch so onResize still runs when persistence throws. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ad7ec01. Configure here.
ApprovabilityVerdict: Approved 86b19d6 Self-contained UI enhancement adding double-click reset to sidebar and viewport-based default width. Changes are limited to sidebar components with simple clamped math, include tests, and only affect user-triggered interactions. You can customize Macroscope's approvability policy. Learn more. |
Derive the expected default width from THREAD_SIDEBAR_DEFAULT_WIDTH_RATIO instead of hardcoding 264. Co-authored-by: Cursor <cursoragent@cursor.com>

Double-clicking the resize rail restores the sidebar to 20% of the viewport width and persists the reset preference.
What Changed
Double-clicking the sidebar resize rail resets the width to 20% of the viewport. The reset is saved to localStorage.
Why
There was no quick way to get back to a default width after resizing. Double-click-to-reset is a familiar pattern and keeps the sidebar proportional across window sizes.
UI Changes
Double-click the resize handle between the sidebar and main content to snap the sidebar back to its default width. Video attached.
Screen.Recording.2026-08-12.at.2.05.12.PM.mov
Checklist
Note
Low Risk
UI-only sidebar sizing and localStorage preference changes; no auth, security, or data-handling impact.
Overview
Adds double-click-to-reset on the sidebar resize rail, snapping width back to a viewport-scaled default (~20%) and persisting that preference.
Replaces the fixed
THREAD_SIDEBAR_DEFAULT_WIDTHwithTHREAD_SIDEBAR_DEFAULT_WIDTH_RATIOandresolveThreadSidebarDefaultWidth, so first-load and reset widths scale with the window (still clamped to min/max).AppSidebarLayoutpasses that live default into the sidebar’s resizable options.Reviewed by Cursor Bugbot for commit 86b19d6. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Reset sidebar width on double-click using viewport-based default
THREAD_SIDEBAR_DEFAULT_WIDTHconstant withTHREAD_SIDEBAR_DEFAULT_WIDTH_RATIO(0.2), so the default sidebar width scales with viewport size and is clamped between min and max bounds.resolveThreadSidebarDefaultWidth(viewportWidth)in threadSidebarWidth.ts to compute this clamped default, and updatesresolveInitialThreadSidebarWidthto use it as the fallback when no stored preference exists.SidebarResizableOptionsin sidebar.tsx with an optionaldefaultWidthprop and wires a double-click handler onSidebarRailthat resets the sidebar to this default, persists it to localStorage, and callsonResize.Macroscope summarized 86b19d6.