Skip to content

fix(hub-ui): prevent nested docks in popup panels - #487

Merged
antfu merged 2 commits into
devframes:mainfrom
SaKaNa-Y:fix/popup-duplicate-dock
Nov 10, 2026
Merged

antfu merged 2 commits into
devframes:mainfrom
SaKaNa-Y:fix/popup-duplicate-dock

Conversation

@SaKaNa-Y

@SaKaNa-Y SaKaNa-Y commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Summary

In Popup mode, opening a same-origin tool page that loads the embedded bootstrap can show a second full dock over the tool's content. The bootstrap checks its parent window for the Hub client context, but the Popup does not publish that context.

Publish the existing context on the Popup window before mounting its views, so the iframe recognizes its Hub parent and skips the duplicate dock.

 mountStandaloneApp(context, popup)
   publish connection metadata
+  publish Hub client context on popup
   construct DockStandalone
   mount views

Evidence

  • Before: The regression test identifies the popup as a Hub before mounting its iframe views fails with expected false to be true.
    After: The test passes. It exercises Popup initialization and calls the real parent detector before view construction. All five focused Popup and parent-detector tests pass.
  • Before: The Vite DevTools playground's Nuxt mock and Debug Dashboard show a second full dock inside Popup.
    After: Browser checks with the rebuilt embedded bundle show no nested dock in the Nuxt mock; page switching works. Edge and Float also show no nested dock.
  • pnpm lint, pnpm knip, pnpm test, pnpm typecheck, and pnpm build pass. The full test run reports 1,837 passed and 14 skipped.

Merge Danger

Door: two-way

The change can be reverted without a data migration.

Blast Radius: Popup

The production change publishes the existing context on the Popup window before its views mount. Embedded pages in that window use it to suppress duplicate docks.

@vercel

vercel Bot commented Nov 6, 2026

Copy link
Copy Markdown

@SaKaNa-Y is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

👁️‍🗨️ Review this pull request with grouped, summarized diffs at:
👉 https://pulls.review/gh/devframes/devframe/487?from=github-actions[bot]

raw result

💭 analyzed by vercel-ai-gateway/anthropic/claude-sonnet-5
🕰️ 2026-11-10 05:45 UTC
🔗 head 16a7151
🤖 automated by pulls.review

{
  "headSha": "16a71516c4e3e61a6bbba09e4e288026bcfb56fb",
  "result": {
    "overallSummary": "Fixes a bug where Popup mode could show a nested dock over a same-origin tool page's content: the Popup window now publishes the Hub client context before mounting its views, so embedded bootstraps recognize their Hub parent and skip rendering a duplicate dock. Includes a regression test for this behavior and an unrelated fix to properly close keep-alive sockets in serve-static test fixtures.",
    "groups": [
      {
        "key": "popup-context-fix",
        "label": "Publish Hub context on popup",
        "summary": "Publishes the existing Hub client context onto the Popup window before its views mount, so same-origin iframe bootstraps detect the Hub parent and skip rendering a duplicate dock.",
        "category": "core",
        "filePaths": [
          "packages/hub-ui/src/client/state/popup.ts"
        ],
        "critical": true,
        "fileNotes": [
          {
            "path": "packages/hub-ui/src/client/state/popup.ts",
            "text": "Sets CLIENT_CONTEXT_KEY on the popup window right before view mounting, mirroring the existing connection-meta propagation pattern."
          }
        ]
      },
      {
        "key": "popup-tests",
        "label": "Popup regression test",
        "summary": "Adds a regression test that opens a Popup and verifies the real parent detector recognizes it as a Hub before its iframe views mount.",
        "category": "tests",
        "filePaths": [
          "packages/hub-ui/src/client/state/popup.test.ts"
        ]
      },
      {
        "key": "serve-static-fixture-fix",
        "label": "Close keep-alive sockets in test fixtures",
        "summary": "Unrelated maintenance fix: ensures test server fixtures call closeAllConnections() so keep-alive sockets don't keep the server open and delay/hang test teardown.",
        "category": "tests",
        "filePaths": [
          "packages/devframe/src/utils/serve-static.test.ts"
        ]
      }
    ],
    "schemaVersion": 1,
    "source": "llm",
    "generatedAt": "2026-11-10T05:45:44.057Z",
    "model": "vercel-ai-gateway/anthropic/claude-sonnet-5",
    "locale": "en"
  }
}

@SaKaNa-Y

SaKaNa-Y commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

before:
截屏2026-11-06 22 01 25

now:
截屏2026-11-06 22 08 45

Node 27 keeps fetch sockets alive, so server.close() never resolved and
the afterEach hooks timed out.
@antfu
antfu merged commit c47fdea into devframes:main Nov 10, 2026
14 of 15 checks passed
@SaKaNa-Y
SaKaNa-Y deleted the fix/popup-duplicate-dock branch November 10, 2026 06:21
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