Open History to see the last commit
1<script setup lang="ts">
2import { computed, onMounted, onScopeDispose, ref, watchEffect } from 'vue'
3import { onlineManager, useQueryClient } from '@tanstack/vue-query'
4import { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'
5import type { StyleValue } from 'vue'
6import type { DevtoolsPanelOptions } from './types'
7β
8const props = defineProps<DevtoolsPanelOptions>()
9const style = computed<StyleValue>(() => {
10 return {
11 height: '500px',
12 ...props.style,
13 }
14})
15β
16const div = ref<HTMLElement>()
17const client = props.client || useQueryClient()
18const devtools = new TanstackQueryDevtoolsPanel({
19 client,
20 queryFlavor: 'Vue Query',
21 version: '5',
22 onlineManager,
23 buttonPosition: 'bottom-left',
24 position: 'bottom',
25 initialIsOpen: true,
26 errorTypes: props.errorTypes,
27 styleNonce: props.styleNonce,
28 shadowDOMTarget: props.shadowDOMTarget,
29 hideDisabledQueries: props.hideDisabledQueries,
30 onClose: props.onClose,
31})
32β
33watchEffect(() => {
34 devtools.setOnClose(props.onClose ?? (() => {}))
35 devtools.setErrorTypes(props.errorTypes || [])
36})
37β
38onMounted(() => {
39 devtools.mount(div.value as HTMLElement)
40})
41β
42onScopeDispose(() => {
43 devtools.unmount()
44})
45</script>
46β
47<template>
48 <div :style="style" className="tsqd-parent-container" ref="div"></div>
49</template>