Skip to content

feat(shared): sync the app registry across tabs via BroadcastChannel (NEXT.md 3.5) - #131

Open
xcjs wants to merge 1 commit into
mainfrom
feat/multitab-sync
Open

xcjs wants to merge 1 commit into
mainfrom
feat/multitab-sync

Conversation

@xcjs

@xcjs xcjs commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Closes #116

What

  • \�pp/features/shared/multitab-sync.ts: owns the \dominic:registry-sync\ BroadcastChannel. Registry mutations broadcast a plain-object snapshot via the existing \onRegistryChange\ API; receiving tabs apply it through the new \importApps()\ registry API, which persists and notifies exactly like a local mutation. Echoes are ignored by per-tab \instanceId; posting is wrapped so a broadcast failure can never break a mutation. Structured clone cannot serialize Vue reactive proxies — found by the new e2e — so snapshots are deep-stripped with \ oRaw\ + JSON round-trip.

  • egistry.ts: \importApps(metas)\ replaces in-memory registry state, persists, notifies (public API only; \�fs.ts\ untouched — Charles owns that seam in 1.1 Async VirtualFileSystem + driver registry (localStorage system, IndexedDB apps, migration) #105).
  • \�pp.vue: \startRegistrySync()\ once in \onMounted, SSR-safe.
  • ADR 0016 (accepted) records the decision and supersedes ADR 0003's deferral without editing that record; index updated.
  • \ ests/e2e/multitab-sync.spec.ts: install in tab A appears in tab B's taskbar without reload; uninstall in A removes it in B.

Scope match

Exactly the union of #116's ## Files\ as amended on the issue: app/features/shared/, app/features/apps/, app/features/os/** (read-only check), docs/adrs/, tests/e2e/, app/app.vue.

Not in scope

Window geometry/focus/workspace sync — per-tab shell state; NEXT.md 2.5 (#113) owns their persistence.

…(NEXT.md 3.5)

Adds multitab-sync.ts owning the dominic:registry-sync channel: registry
mutations broadcast a plain-object snapshot through the existing
onRegistryChange API, receiving tabs apply it via the new registry
importApps() (which persists + notifies like a local mutation). Echoes
are ignored by instance id; app source stays out of the channel (shared
localStorage VFS). Wired once in app.vue onMounted; SSR-safe.

Window geometry/focus/workspaces are per-tab shell state and are not
synced (NEXT.md 2.5 owns their persistence).

Recorded as ADR 0016 (accepted), superseding ADR 0003's deferral
without editing that record. e2e covers install and uninstall fan-out
across tabs.

Closes #116
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.

3.5 Multi-tab sync via BroadcastChannel (ADR 0003 deferred item)

1 participant