feat(plan-sidebar): add drag-to-resize with localStorage persistence#1439
Open
mia-riezebos wants to merge 3 commits intopingdotgg:mainfrom
Open
feat(plan-sidebar): add drag-to-resize with localStorage persistence#1439mia-riezebos wants to merge 3 commits intopingdotgg:mainfrom
mia-riezebos wants to merge 3 commits intopingdotgg:mainfrom
Conversation
The Plan sidebar was hardcoded at 340px with no way to resize it. Now it has a proper resize handle on its left edge - drag to widen or narrow between 240-560px. Width persists across close/reopen and page refresh via localStorage. Follows the same pointer-capture pattern as ThreadTerminalDrawer: pointerDown captures, pointerMove updates width in real-time, pointerEnd persists to storage. The resize hit-area lives fully inside the sidebar bounds so it never overlaps the chat scroll viewport. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PlanSidebar is conditionally rendered — if the component unmounts mid-drag (user closes the sidebar while resizing), the body cursor and user-select overrides would leak permanently. Added a useEffect cleanup that unconditionally removes them, matching SidebarRail's existing cleanup pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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 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 |
Turns out localStorage remembers everything, including bad data. If `plan-sidebar-width` gets corrupted, `Schema.decodeSync` would throw inside the lazy state initializer and the sidebar would faceplant before it mounted. This catches decode failures, logs the error, and falls back to the default width so one busted persisted value doesn't take the whole panel down. Co-Authored-By: GPT-5.4 <noreply@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
Adds drag-to-resize to the Plan sidebar and follows up with cleanup for drag styles if the sidebar unmounts mid-resize.
w-[340px]layout with a dynamic width driven by React statePlanSidebarlocalStoragedocument.bodycursor anduser-selectoverrides if the sidebar unmounts during a dragWhy
The Plan sidebar was fixed at 340px with no way to adjust it for different screen sizes or content widths.
This implementation keeps the resize handle fully inside the Plan sidebar bounds so it does not steal pointer interactions from the chat area. That is the same class of interaction problem described in #958, but this PR does not close #958 because that issue is specifically about the diff sidebar /
SidebarRail.Supersedes #1438 to correct the commit history and remove the incorrect
Closes #958reference from the original branch.UI Changes
This is a drag-interaction change. The resize handle is invisible by default and shows a 2px border indicator on hover, consistent with the existing resize affordances.
Before:
Screen.Recording.2026-03-26.at.14.37.34_compressed.mp4
After:
Screen.Recording.2026-03-26.at.14.39.16_compressed.mp4
Checklist
Note
Low Risk
Low risk UI-only change that adds pointer-based resizing and localStorage persistence; main risk is minor UX regressions (drag/scroll interactions or leaked cursor styles) mitigated by pointer capture and unmount cleanup.
Overview
Adds drag-to-resize support to
PlanSidebarby replacing the fixedw-[340px]width with a state-driven inline width and a left-edge pointer resize handle.Sidebar width is clamped (240–560px), restored from
localStorageon mount, and persisted back tolocalStorageon drag end; bodycursor/user-selectoverrides are applied during drag and cleaned up on release or unmount.Written by Cursor Bugbot for commit 27f82f7. This will update automatically on new commits. Configure here.
Note
Add drag-to-resize with localStorage persistence to
PlanSidebarplan-sidebar-widthand restored on subsequent renders via a newreadStoredWidthhelper.document.bodycursor is set tocol-resizeand text selection is disabled; both are cleaned up on drag end or unmount.Macroscope summarized 27f82f7.