Repository navigation
fix(work-panel): lend width to a reopened sidebar instead of storing it - #1735
Merged
Merged
Conversation
Reopening the sidebar spends work-panel width so MainChat keeps its 460px target. The reopen stored that squeezed width as the preferred width, so the panel stayed narrow after the sidebar collapsed again or the window grew, and the narrow width survived a restart. With a stored width below 244px, WorkPanel switched every resize gesture to the 1px compact minimum, so a divider drag could shrink the panel to a sliver until it was dragged back above 244px. Lend the reopen width instead. It lives only in renderer memory, extra client width goes back to the panel first, and collapsing the sidebar or resizing the panel ends the loan. Committed and loaded widths keep the 244px minimum, a gesture starts from the shown width and cannot go narrower, and the sidebar budget and pending dock use the lent width.
Owner
|
Thanks for the focused fix and for documenting the narrow-window reproduction. I verified the 866px reopen/restore path, the persisted preferred width, and the 244px drag floor on the latest-main integration candidate. The targeted panel tests passed (22/22), the layout E2E passed (205/205), the updated PR CI and Docs checks are green, and the PR-base gate passed. Merged as |
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.
Summary
Keep the work panel's preferred width when a manual sidebar reopen squeezes the
panel. The reopen stored the squeezed width as the user's width, so the panel
stayed narrow after the sidebar collapsed again or the window grew, and the
narrow width survived a restart. When the squeezed width was below 244px, the
divider minimum also dropped to 1px.
loan lives only in renderer memory. Extra client width goes back to the panel
first, and collapsing the sidebar or resizing the panel ends the loan.
starts a drag from its current width and cannot be dragged narrower.
as 244px.
The reopen priority of ADR 0238 is unchanged: the panel gives up width first
and MainChat lands on its 460px target. Decision 3 of that ADR, which allowed
the compact width to be persisted, is amended.
Reproduction
Reproduced against main
4f9f051e54c495ac0c5164f2ef4dd687c704bc11onOctober 17, 2026, in an 866px shell with the default 275px sidebar and a
360px panel.
Reopen the sidebar, then collapse it again
fit beside the sidebar, so the layout collapses the sidebar.
Before: The panel stays at 131px although 416px are available.
pi.desktop.workPanelnow holds{"width":131}, so the next launch alsoopens the panel at 131px.
After: The reopen shows 131px without storing it. Collapsing the sidebar
restores 360px, and the stored width stays
{"width":360}.Drag the divider after the reopen
narrower.
Before: The stored width is below 244px, so the gesture uses the 1px
compact minimum and the panel can be dragged down to a 1px sliver. Dragging it
back above 244px restores the limit, so the minimum appears and disappears.
After: The drag stops at 244px.
Any constrained reopen overwrote the preferred width. With the 800 DIP window
minimum and default widths, the squeezed width falls below 244px at shell
widths up to about 978px, or in wider windows with a wider sidebar.
Changes
work-panel-resize.ts:workPanelRequestedWidthresolves the width the panel asks of thethree-column budget: the preferred width, or the lent width while the
reopened sidebar stays expanded, with extra client width given back to the
panel first.
workPanelGestureMinimumgives resize gestures the 244px minimum, or theshown width when that is narrower.
workPanelYieldedWidthis runtime-only state, set throughsetWorkPanelYieldedWidth.setWorkPanelWidthkeeps the 244px minimum and ends a loan.loadWorkPanelWidthraises stored widths below 244px.useAppShellRuntime:setWorkPanelWidth.collapsed it.
AppShelluse therequested width, so the sidebar resize range follows the shown panel width.
WorkPanel:01-ui-ia,09-interaction-patternsandE2E-LAYOUT-three-column-width-priority are updated, with their zh-CN
mirrors.
work-panel-resize.test.mjs.work-panel-width-preference.test.mjs.scripts/e2e-three-column-layout.mjs.Validation
Candidate:
5a8ae904f1c0324473260523f653fcda1f923535Base main:
4f9f051e54c495ac0c5164f2ef4dd687c704bc11Environment: Windows 11 (10.0.26200), Electron 43.6.0, Node
24.14.0, Rust 1.90.0.
The new layout checks fail against unmodified upstream product code:
{"width":131}is stored, the panel stays at 131px after the sidebarcollapses, and the drag reaches 1px. All four pass on the candidate.
pnpm test:e2e:layout: 82 passed on the candidate. The same 9 checksfail on the candidate and on unmodified upstream: the four darwin-only
preview-header geometry checks and the sidebar group reload/fold sequence
that ends in
nextKey.The new store regressions fail against the unmodified work-panel slice
(4/4) and pass with the fix.
49/49 tests passed in
work-panel-resize.test.mjs,work-panel-width-preference.test.mjsandwork-panel.test.mjs.Full desktop
node --test: 4,005 of 4,076 passed and 8 wereskipped. The 63 failures are in files that failed the same way on an
unmodified upstream run on this machine (
f21c550e7):shtransports;new URL(...).pathname;sidebar-pinned-renderingalso fails against the unmodified product codeat
4f9f051e5.chat-links-performancefailed only under the parallelrun and passes on its own.
Workspace build, Desktop typecheck, Biome lint, style tokens,
architecture budgets, agent-policy and
git diff --checkpassed.Documentation checks passed for 86 English/Chinese pairs and
578 pages.
Manual pointer testing on an isolated fork build that carries the same
product change: the reopen width was never stored. The only stored widths
were the tester's own drags, 365px and then 244px.
E2E entry points
The layout E2E launches the built app with throwaway profiles. The 866px case
uses CDP viewport emulation, so the native window keeps its size. No provider,
account or user profile is involved. These results do not claim macOS/Linux
runs or installer packaging.
Scope
MainChat lands on 460px. Auto-collapse and restore, preview mode and native
window behavior are also unchanged.
host or schema change. The only persisted difference is that
pi.desktop.workPanelnever stores, and never loads, a width below 244px.Previously it rewrote the same width.
artifacts are included.
Review
Suggested reviewer focus:
collapsed sidebar, by any path, or an explicit resize ends it. It survives
panel close/open and session switches while the sidebar stays expanded.
its preferred width, while MainChat stays at 460px. A narrower window keeps
the lent width until it no longer fits; then the sidebar yields as before.
jumps and a drag never reaches a sliver.
uses the shown panel width, as it did when the squeezed width was stored.
path could write, loads as 244px.