Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ function createMockContext(
docks: {
switchEntry: vi.fn(),
},
rpc: {
connectionMeta: { backend: 'ws' },
},
} as unknown as DocksContext
}

Expand Down Expand Up @@ -175,6 +178,8 @@ describe('dock popup state', () => {
expect(appRoot).toBeTruthy()
expect(appRoot.id).toBe('vite-devtools-popup-root')
expect(appRoot.appended).toHaveLength(1)
expect((popup as unknown as { __DEVFRAME_CONNECTION_META__?: unknown }).__DEVFRAME_CONNECTION_META__)
.toBe(context.rpc.connectionMeta)
})

it('hides dock overflow panel when opening popup', async () => {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/client/webcomponents/state/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const PANEL_MAX_SIZE = 100
const POPUP_MIN_WIDTH = 320
const POPUP_MIN_HEIGHT = 240
const MAIN_FRAME_ACTION_HANDLER_KEY = '__VITE_DEVTOOLS_TRIGGER_DOCK_ACTION__'
const DEVFRAME_CONNECTION_META_KEY = '__DEVFRAME_CONNECTION_META__'

const popupWindow = shallowRef<Window | null>(null)
const isPopupOpen = shallowRef(false)
Expand Down Expand Up @@ -179,6 +180,8 @@ async function mountStandaloneApp(context: DocksContext, popup: Window) {
popup.document.head?.appendChild(baseStyle)
popup.document.body.textContent = ''

;(popup as Window & { [DEVFRAME_CONNECTION_META_KEY]?: unknown })[DEVFRAME_CONNECTION_META_KEY] = context.rpc.connectionMeta

const appRoot = popup.document.createElement('div')
appRoot.id = 'vite-devtools-popup-root'
popup.document.body.appendChild(appRoot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function useIframePanes(
container,
(el) => {
if (el && !panes.value) {
panes.value = markRaw(createIframePanes({ container: el }))
panes.value = markRaw(createIframePanes({ container: el, document: el.ownerDocument }))
stop()
}
},
Expand Down
Loading