@@ -4,8 +4,8 @@ import type { $Fetch } from 'ofetch'
44import type { Ref } from 'vue'
55
66import type { Router } from 'vue-router'
7+ import { getDevframeClientContext } from '@devframes/hub/client'
78import { NuxtDevtoolsInspectPanel } from '@nuxt/devtools/webcomponents'
8- import { getDevToolsClientContext } from '@vitejs/devtools-kit/client'
99
1010import { createHooks } from 'hookable'
1111import { debounce } from 'perfect-debounce'
@@ -17,14 +17,14 @@ import { useAppConfig } from '#imports'
1717
1818import { initTimelineMetrics } from '../../function-metrics-helpers'
1919
20- // The `Nuxt` dock group id (see `NUXT_DEVTOOLS_GROUP_ID`). Activating the group
21- // auto-opens its `defaultChildId` ( the shared-frame anchor). The anchor iframe
22- // dock (`nuxt:devtools`) hosts the one kept-alive client iframe that all tab
23- // members soft-navigate within .
24- const NUXT_DOCK_GROUP_ID = 'nuxt'
20+ // Host controls must update the visible Devframe viewer context, rather than
21+ // Vite's separate dock-registration context. Target the shared-frame anchor
22+ // explicitly so open/navigate always mounts the one kept-alive client iframe
23+ // used by every Nuxt tab .
24+ const NUXT_DOCK_ANCHOR_ID = 'nuxt:devtools '
2525
26- function getViteDevToolsContext ( ) {
27- return getDevToolsClientContext ( ) as any
26+ function getDevframeContext ( ) {
27+ return getDevframeClientContext ( ) as any
2828}
2929
3030const clientRef = shallowRef < NuxtDevtoolsHostClient > ( )
@@ -56,27 +56,27 @@ export async function setupDevToolsClient({
5656
5757devtools : {
5858toggle ( ) {
59- const ctx = getViteDevToolsContext ( )
59+ const ctx = getDevframeContext ( )
6060if ( ctx )
61- ctx . docks . toggleEntry ( NUXT_DOCK_GROUP_ID )
61+ ctx . docks . toggleEntry ( NUXT_DOCK_ANCHOR_ID )
6262} ,
6363close ( ) {
64- const ctx = getViteDevToolsContext ( )
64+ const ctx = getDevframeContext ( )
6565if ( ctx )
66- ctx . panel . store . open = false
66+ ctx . panel . session . open = false
6767} ,
6868open ( ) {
69- const ctx = getViteDevToolsContext ( )
69+ const ctx = getDevframeContext ( )
7070if ( ctx ) {
71- ctx . panel . store . open = true
72- ctx . docks . switchEntry ( NUXT_DOCK_GROUP_ID )
71+ ctx . panel . session . open = true
72+ ctx . docks . switchEntry ( NUXT_DOCK_ANCHOR_ID )
7373}
7474} ,
7575async navigate ( path : string ) {
76- const ctx = getViteDevToolsContext ( )
76+ const ctx = getDevframeContext ( )
7777if ( ctx ) {
78- ctx . panel . store . open = true
79- ctx . docks . switchEntry ( NUXT_DOCK_GROUP_ID )
78+ ctx . panel . session . open = true
79+ ctx . docks . switchEntry ( NUXT_DOCK_ANCHOR_ID )
8080}
8181await client . hooks . callHook ( 'host:action:navigate' , path )
8282} ,
0 commit comments