Skip to content

fix(core): land a subTabs anchor on its live member tab, not the hidden anchor - #473

Merged
antfu merged 1 commit into
mainfrom
fix/dock-group-default-child-visibility
Jul 24, 2026
Merged

fix(core): land a subTabs anchor on its live member tab, not the hidden anchor#473
antfu merged 1 commit into
mainfrom
fix/dock-group-default-child-visibility

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Description

Follow-up to #472. That PR fixed a group whose defaultChildId points at a visibility: 'false' subTabs anchor so the group button stays reachable and clicking it boots the shared frame. But the three features still didn't play well together: every activation after the first re-selected the invisible anchor itself, so no dock ended up highlighted and the group button read as inactive.

Root cause: a subTabs anchor has no view of its own — it only exists to mount the shared iframe, and its synthesized member tabs (<frameId>:<tabId>) render the real buttons. defaultChildId → anchor is a bootstrap hook, so selection lingered on a dock that is deliberately hidden from the bar.

switchEntry (packages/core/src/client/webcomponents/state/context.ts) now tracks the shared frame's current member tab per frameId. When a subTabs anchor is selected after the frame has reported a tab — via a group defaultChildId, the command palette, or an RPC activation — it redirects to that live member so a visible dock stays highlighted. The very first boot, before any member exists, still selects the anchor to mount its iframe; if the remembered member is later disposed (manifest empties), it falls back to booting the anchor afresh.

To verify the fix, the core playground now dogfoods the real-world pattern by hiding the Nuxt anchor with visibility: 'false' (the anchor drives the nav loop; only its Overview/Pages/… member tabs get their own buttons). Added regression tests over the full group → defaultChildId → hidden anchor → member flow (first-boot, re-selection, group re-open, and the disposed-member fallback).

Linked Issues

Follow-up to #472.

Additional context

Verified with pnpm exec vitest run (358 passing), pnpm build, vue-tsc -b, and eslint on the touched files, all clean. The one remaining eslint error (packages/core/src/node/ws.ts import order) pre-exists on main and is unrelated to this change.

This PR was created with the help of an AI coding agent.

…en anchor

A group whose `defaultChildId` points at a `visibility: 'false'` subTabs
anchor booted the shared frame correctly, but every later activation
re-selected the invisible anchor itself — leaving no dock highlighted and
the group button reading as inactive.

`switchEntry` now tracks the shared frame's current member tab per `frameId`
and, when a `subTabs` anchor is selected after the frame has reported a tab,
redirects to that live member so a visible dock stays highlighted. The first
boot (no member yet) still selects the anchor to mount its iframe.

Dogfood the pattern in the core playground by hiding the Nuxt anchor with
`visibility: 'false'`, and cover the group→anchor→member flow with regression
tests.
@pkg-pr-new

pkg-pr-new Bot commented Jul 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@473

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@473

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@473

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@473

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@473

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@473

commit: b0e8183

@antfu
antfu merged commit 5d668e2 into main Jul 24, 2026
9 of 10 checks passed
@antfu
antfu deleted the fix/dock-group-default-child-visibility branch July 24, 2026 15:23
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