feat(settings): sync activeSidebarTab across devices via settings.json#61
Merged
Merged
Conversation
useLayoutStore.activeSidebarTab is the only "which agent" UI state that wasn't already going through ~/.codexia/settings.json — it has its own persist(localStorage) middleware, so it stays per-browser even though the rest of useWorkspaceStore (projects, selectedAgent, historyProjects, cwd) syncs cross-device in web mode via the existing snapshot/hydrate mechanism in src/lib/settings.ts. Plumbs the same fields through: - LayoutData type alongside WorkspaceData/ThemeData - layout?: Partial<LayoutData> in SettingsFile - Hydrate useLayoutStore.activeSidebarTab from data.layout - Include it in snapshot() output - useLayoutStore.subscribe(scheduleWrite) in initSettingsSync Other layout fields (sidebar open, panel sizes, view) stay per-device-only via the existing layout-storage localStorage; only the agent tab follows the user across devices. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Tiny patch —
useLayoutStore.activeSidebarTabis the one piece of "which agent am I looking at" state that wasn't already syncing across devices in web mode. It still uses its ownpersist(localStorage)middleware, so phone and laptop have independent agent tabs even though projects, selectedAgent, historyProjects, cwd, theme, locale, etc. all flow through~/.codexia/settings.jsonalready (viasrc/lib/settings.ts).This plumbs
activeSidebarTabthrough the same snapshot/hydrate mechanism so the agent tab follows the user across devices on next load.What changes
LayoutDatatype alongsideWorkspaceData/ThemeDatalayout?: Partial<LayoutData>inSettingsFileuseLayoutStore.activeSidebarTabfromdata.layoutinloadSettings()snapshot()useLayoutStore.subscribe(scheduleWrite)ininitSettingsSync()15-line diff in
src/lib/settings.ts. OtheruseLayoutStorefields (sidebar open/closed, panel sizes, view, terminal open, diff word wrap) stay per-device-only via the existinglayout-storagelocalStorage — only the agent tab is intentionally synced.Test plan
bunx tsc --noEmitcleanbun run buildclean🤖 Generated with Claude Code