Skip to content

Commit

Permalink
fix: missing pinia store modules (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
webfansplz authored Nov 20, 2024
1 parent a6e0bdc commit be243e4
Show file tree
Hide file tree
Showing 3 changed files with 361 additions and 66 deletions.
31 changes: 25 additions & 6 deletions packages/devtools/client/setup/vue-devtools.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
import { functions, onRpcConnected, rpc } from '@vue/devtools-core'
import { createRpcClient, toggleHighPerfMode } from '@vue/devtools-kit'
import { functions, onRpcConnected, rpc, useDevToolsState as useVueDevToolsState } from '@vue/devtools-core'
import { createRpcClient } from '@vue/devtools-kit'
import { watchEffect } from 'vue'
import { useDevToolsFrameState } from '../composables/storage'

export function setupVueDevTools() {
const { connected } = useVueDevToolsState()

const state = useDevToolsFrameState()

const isInPopup = window.__NUXT_DEVTOOLS_IS_POPUP__

function toggleClientDetected(state: boolean) {
if (connected.value) {
rpc.value.updateDevToolsClientDetected({
iframe: state,
})
}
else {
onRpcConnected(() => {
rpc.value.updateDevToolsClientDetected({
iframe: state,
})
})
}
}

watchEffect(() => {
if (isInPopup)
toggleHighPerfMode(false)
else
toggleHighPerfMode(!state.value?.open)
if (isInPopup) {
toggleClientDetected(true)
}
else {
toggleClientDetected(state.value?.open ?? false)
}
})

createRpcClient(functions, {
Expand Down
Loading

0 comments on commit be243e4

Please sign in to comment.