Skip to content

Fix sidebar resize limit after window growth#4482

Open
colonelpanic8 wants to merge 3 commits into
pingdotgg:mainfrom
colonelpanic8:fix/sidebar-resize-after-window-growth
Open

Fix sidebar resize limit after window growth#4482
colonelpanic8 wants to merge 3 commits into
pingdotgg:mainfrom
colonelpanic8:fix/sidebar-resize-after-window-growth

Conversation

@colonelpanic8

@colonelpanic8 colonelpanic8 commented Jul 24, 2026

Copy link
Copy Markdown

What Changed

  • Recompute the thread sidebar maximum width when the browser or Electron window resizes.
  • Add focused coverage showing that the allowed sidebar width grows with the viewport.

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.ts
  • vp lint apps/web/src/components/AppSidebarLayout.tsx apps/web/src/components/threadSidebarWidth.test.ts
  • git diff --check
  • Web package typecheck attempted; it is currently blocked by unrelated existing errors in BranchToolbarBranchSelector, ModelPickerContent, PreviewAutomationHosts, and state atom hooks.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (preview capture timed out)
  • I included a video for animation/interaction changes (preview recording failed)

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.

AppSidebarLayout now drives --sidebar-width through resolveThreadSidebarCssWidth (a live min/max/calc(100vw …) expression) and passes a maxWidth callback that reads window.innerWidth on each clamp during rail resize. Initial load reads storage with only min/default handling (hydrateStoredWidth: false on the shared Sidebar so hydration stays in the layout).

The shared Sidebar rail gains optional getCssWidth and hydrateStoredWidth, function-valued maxWidth, clamp helpers, commit-time CSS updates via getCssWidth, persisting the clamped width, and onResize(storedWidth) on hydrate so the numeric preference is not lost when the viewport is temporarily narrow. A resize listener 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

  • The sidebar's maximum width was previously clamped at read time, so growing the window did not increase the allowed resize limit. Now maxWidth is resolved dynamically per-resize via window.innerWidth.
  • Adds resolveThreadSidebarCssWidth and resolveSidebarCssWidth helpers that express sidebar width as a CSS min/max expression, so the sidebar clamps live in CSS instead of only at resize commit time.
  • Stored width hydration is decoupled: hydrateStoredWidth can be disabled on the Sidebar component, with the caller (AppSidebarLayout) managing its own hydration.
  • On window resize, CSS transitions are temporarily suppressed to avoid visual glitches when the sidebar width is adjusted to fit the new viewport.
  • Behavioral Change: readInitialThreadSidebarWidth no longer clamps to the viewport at read time; it clamps only to THREAD_SIDEBAR_MIN_WIDTH and falls back to THREAD_SIDEBAR_DEFAULT_WIDTH.

Macroscope summarized ea0cea1.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

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 Plus

Run ID: dffd4678-ac8d-48f3-867b-3b22f7497fc7

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jul 24, 2026
Comment thread apps/web/src/components/AppSidebarLayout.tsx
Comment thread apps/web/src/components/AppSidebarLayout.tsx Outdated
Comment thread apps/web/src/components/AppSidebarLayout.tsx Outdated
Comment thread apps/web/src/components/AppSidebarLayout.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Approvability

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

@colonelpanic8
colonelpanic8 force-pushed the fix/sidebar-resize-after-window-growth branch from 233e5db to 8e3f616 Compare July 25, 2026 00:08
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Jul 25, 2026
Comment thread apps/web/src/components/ui/sidebar.tsx Outdated
Comment thread apps/web/src/components/ui/sidebar.tsx Outdated
@colonelpanic8
colonelpanic8 force-pushed the fix/sidebar-resize-after-window-growth branch from 8e3f616 to 15fe789 Compare July 25, 2026 00:31

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread apps/web/src/components/ui/sidebar.tsx
@colonelpanic8
colonelpanic8 force-pushed the fix/sidebar-resize-after-window-growth branch from 081e832 to ea0cea1 Compare July 25, 2026 03:23
colonelpanic8 added a commit to colonelpanic8/t3code that referenced this pull request Jul 25, 2026
colonelpanic8 added a commit to colonelpanic8/t3code that referenced this pull request Jul 25, 2026
colonelpanic8 added a commit to colonelpanic8/t3code that referenced this pull request Jul 25, 2026
colonelpanic8 added a commit to colonelpanic8/t3code that referenced this pull request Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 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.

1 participant