Skip to content

feat(settings): sync activeSidebarTab across devices via settings.json#61

Merged
milisp merged 1 commit into
milisp:masterfrom
akakabrian:feat/sync-sidebar-tab
Apr 27, 2026
Merged

feat(settings): sync activeSidebarTab across devices via settings.json#61
milisp merged 1 commit into
milisp:masterfrom
akakabrian:feat/sync-sidebar-tab

Conversation

@akakabrian
Copy link
Copy Markdown
Contributor

Summary

Tiny patch — useLayoutStore.activeSidebarTab is 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 own persist(localStorage) middleware, so phone and laptop have independent agent tabs even though projects, selectedAgent, historyProjects, cwd, theme, locale, etc. all flow through ~/.codexia/settings.json already (via src/lib/settings.ts).

This plumbs activeSidebarTab through the same snapshot/hydrate mechanism so the agent tab follows the user across devices on next load.

What changes

  • LayoutData type alongside WorkspaceData / ThemeData
  • layout?: Partial<LayoutData> in SettingsFile
  • Hydrate useLayoutStore.activeSidebarTab from data.layout in loadSettings()
  • Include it in snapshot()
  • useLayoutStore.subscribe(scheduleWrite) in initSettingsSync()

15-line diff in src/lib/settings.ts. Other useLayoutStore fields (sidebar open/closed, panel sizes, view, terminal open, diff word wrap) stay per-device-only via the existing layout-storage localStorage — only the agent tab is intentionally synced.

Test plan

  • bunx tsc --noEmit clean
  • bun run build clean
  • Web mode: pick "Codex" tab on device A → reload device B → device B opens with Codex tab active
  • Same in reverse with "CC" tab
  • Other layout state (sidebar open/closed, right panel size) stays independent per device

🤖 Generated with Claude Code

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>
@milisp milisp merged commit 9a0cc31 into milisp:master Apr 27, 2026
1 check failed
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.

2 participants