fix(hub-ui): restore docks after initialization - #276
Conversation
|
@dvcolomban is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
This PR makes hub-ui’s persisted dock restoration deterministic by deferring the initial restore until the RPC connection is trusted and the first server-backed dock registry and renderer manifest syncs have arrived, preventing “open but unmounted” (or “mounted before renderer exists”) states during reload.
Changes:
- Add “initial sync complete” gates for
devframe:docksand the dock-renderer manifest, and restore only after those plus RPC trust are ready. - Keep the persisted selection effectively unmounted/unselected while the initial restore is pending, with user interaction canceling the pending restore.
- Add vitest coverage for delayed registries/manifests and cancellation behavior; include
packages/hub-uiin the workspace vitest projects.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Adds packages/hub-ui to the vitest workspace projects so hub-ui tests run. |
| packages/hub-ui/src/client/state/docks.ts | Introduces waitForInitialSharedStateSync and returns { entries, initialSyncComplete } for dock entries shared-state. |
| packages/hub-ui/src/client/state/context.ts | Gates persisted dock restoration on RPC trust + first dock registry sync + first renderer manifest sync; keeps initial restore pending unmounted until ready/canceled. |
| packages/hub-ui/src/client/state/context.test.ts | Adds regression tests covering delayed initial sync, cancellation, and single restore invocation. |
| packages/hub-ui/src/client/components/views/ViewDockRenderer.vue | Wraps onMounted invocation to call the async mount() without passing an async function directly. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
packages/hub-ui/src/client/components/views/ViewDockRenderer.vue:64
- Wrapping the async
mount()call inonMounted(() => { void mount() })prevents Vue from seeing/handling the returned Promise. Ifmount()ever rejects (e.g. unexpected renderer errors), this can turn into an unhandled promise rejection instead of being captured by Vue’s async error handling.
Prefer passing the async function directly (or returning the Promise) so Vue can catch and report errors consistently.
onMounted(() => {
void mount()
})
What changed
Why
RPC trust can complete before dock entries and renderer registrations arrive. Restoring selection during that gap can reopen a collapsed edge panel without mounting its dock, or mount a floating dock before its JSON renderer exists. Gating the initial restore on authoritative synchronization makes the lifecycle deterministic without retries, polling, or public API changes.
Before
Screen.Recording.2026-08-21.at.16.49.36.mov
After
Screen.Recording.2026-08-21.at.16.42.33.mov