fix(agent-sidebar): stop reload from clobbering saved state (0.5.9)#311
Merged
Conversation
…load clobber)
schedulePut() only gated on persistence+enabled, so a mount-time mutation (host bridge setOpen, route-driven tab change) PUT the empty un-hydrated strip before the GET settled — permanently overwriting the server's saved state with {tabs:[], placeholder width}. Reproduced live: persisted width 653 -> server clobbered to {tabs:[],activeTabId:null,width:384} after a few reloads. Gate schedulePut on hasHydratedRef (set even on GET failure, so saves never stall). Adds a RED/GREEN regression test (pre-hydration mutation must not PUT).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ships the sidebar save-clobber fix. release label publishes on merge. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Storybook Preview: https://mirrorstack-ai.github.io/web-ui-kit/pr/311/ |
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.
Live-reproduced root cause
Reloading the agent sidebar reverted width to default and history → new chat, and stayed reverted. Reproduced via Playwright on the deployed 0.5.8: persisted width 653 → after a few reloads the server record itself became
{open:true,activeTabId:null,tabs:[],width:384}. So both symptoms are ONE bug: a save before hydration overwrites the server.useAgentTabs.schedulePutonly gated onpersistence+enabled, not hydration. A mount-time mutation (host bridgesetOpen, route-driven tab change) →mutate → schedulePut→ PUT of the empty un-hydrated strip before the GET settles → permanent clobber. #305/#308(0.5.8)/#309 fixed restore authority but never gated the save.Fix
schedulePutrefuses to persist untilhasHydratedRefis set (set even on GET failure in reconcile'sfinally, so saves never stall). Width clobber is fixed by the same gate (the clobbering PUT was this tab-put carrying the placeholder width).Tests
RED→GREEN regression: a pre-hydration mutation must not
put. Verified ✗ without the fix, ✓ with it. Full suite 777/777, typecheck + build clean.releaselabel → publishes 0.5.9.