Skip to content

fix(agent-sidebar): remember a drag to the minimum width (single-writer width)#321

Merged
I-am-nothing merged 1 commit into
mainfrom
fix/sidebar-single-writer
Jun 30, 2026
Merged

fix(agent-sidebar): remember a drag to the minimum width (single-writer width)#321
I-am-nothing merged 1 commit into
mainfrom
fix/sidebar-single-writer

Conversation

@I-am-nothing

Copy link
Copy Markdown
Contributor

What

Root-cause fix for "drag the agent sidebar to its minimum → reopen forgets it." The kit used a strict > minOpenWidth in handleSetWidth and reopenWidth, so a width equal to the floor was treated as a collapse and never recorded — lastOpenWidth kept the previous size and reopen restored that. The floor is now an inclusive valid open width (>=); the collapse button shrinks via seedWidth (non-recording), so collapsing to the floor still can't overwrite the remembered size.

Also: useAgentTabs now owns width + setWidth, making the strip the single writer of the whole sidebar-state record (open + tabs + activeTabId + width); SidebarProvider.apply() records the first real writer once and never lets a late read clobber a recorded drag.

No version bump — releases as part of 0.6.0 (coordinated separately).

Verification (live on a worktree dev server, web-applications :3004): drag the rail to its 350px minimum → close → reopen restores 350 (previously snapped back to the prior width); sidebar state persists to localStorage; 0 calls to /v1/sidebar-state. Kit unit tests green (40/40, incl. a new drag-to-floor regression test).

handleSetWidth/reopenWidth used a strict `> minOpenWidth`, treating a width EQUAL to the floor as a collapse — so dragging the rail to its minimum was dropped and reopen restored the previous size. The floor is now an inclusive `>=` valid open width; the collapse button shrinks via seedWidth so collapsing to the floor still never records. useAgentTabs also gains width+setWidth (the strip is the single writer of the whole record); the hydration applies the first REAL writer once and won't let a late read clobber a recorded drag. No version bump (ships in 0.6.0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Storybook Preview: https://mirrorstack-ai.github.io/web-ui-kit/pr/321/

github-actions Bot added a commit that referenced this pull request Jun 30, 2026
@I-am-nothing I-am-nothing merged commit 6fee093 into main Jun 30, 2026
4 checks passed
github-actions Bot added a commit that referenced this pull request Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant