Skip to content

fix(hub-ui): restore docks after initialization - #276

Merged
antfu merged 3 commits into
devframes:mainfrom
dvcolomban:codex/fix-edge-dock-refresh
Aug 21, 2026
Merged

fix(hub-ui): restore docks after initialization#276
antfu merged 3 commits into
devframes:mainfrom
dvcolomban:codex/fix-edge-dock-refresh

Conversation

@dvcolomban

@dvcolomban dvcolomban commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Wait for RPC trust, the first dock registry sync, and the first renderer manifest sync before restoring a persisted dock.
  • Keep the pending restored dock unselected and unmounted until initialization completes, while letting user selection or close cancel restoration.
  • Remove the renderer-availability remount watcher and add regression coverage for delayed registries, empty manifests, cancellation, and single invocation.
  • Validate Git restoration after refresh in edge and floating modes through Chrome DevTools MCP and manual playground testing.

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

@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

@dvcolomban is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@dvcolomban
dvcolomban marked this pull request as ready for review August 21, 2026 15:40
Copilot AI lite review requested due to automatic review settings August 21, 2026 15:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:docks and 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-ui in 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.

Comment thread packages/hub-ui/src/client/state/docks.ts Outdated
Comment thread packages/hub-ui/src/client/state/context.ts Outdated
Copilot AI review requested due to automatic review settings August 21, 2026 17:17
@dvcolomban
dvcolomban marked this pull request as draft August 21, 2026 17:18
@dvcolomban
dvcolomban marked this pull request as ready for review August 21, 2026 17:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in onMounted(() => { void mount() }) prevents Vue from seeing/handling the returned Promise. If mount() 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()
})

Comment thread packages/hub-ui/src/client/state/context.ts
Comment thread packages/hub-ui/src/client/state/context.test.ts
Copilot AI review requested due to automatic review settings August 21, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@antfu
antfu merged commit 171b8bf into devframes:main Aug 21, 2026
9 of 10 checks passed
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 participants