fix(agent-sidebar): remember a drag to the minimum width (single-writer width)#321
Merged
Conversation
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>
Contributor
|
Storybook Preview: https://mirrorstack-ai.github.io/web-ui-kit/pr/321/ |
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
Root-cause fix for "drag the agent sidebar to its minimum → reopen forgets it." The kit used a strict
> minOpenWidthinhandleSetWidthandreopenWidth, so a width equal to the floor was treated as a collapse and never recorded —lastOpenWidthkept the previous size and reopen restored that. The floor is now an inclusive valid open width (>=); the collapse button shrinks viaseedWidth(non-recording), so collapsing to the floor still can't overwrite the remembered size.Also:
useAgentTabsnow ownswidth+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).