[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot] 2024-10-24 06:24:09 +00:00 committed by GitHub
parent 8c6a92d316
commit a577158909
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 21 deletions

View File

@ -1,10 +1,13 @@
import {debug} from '../src/debug' import { debug } from '../src/debug'
import { import {
h, type ComponentInternalInstance,
render,
defineComponent, defineComponent,
ref, getCurrentInstance, ComponentInternalInstance, nodeOps, getCurrentInstance,
serializeInner as inner h,
serializeInner as inner,
nodeOps,
ref,
render,
} from '@vue/runtime-test' } from '@vue/runtime-test'
describe('debug', () => { describe('debug', () => {
@ -17,9 +20,7 @@ describe('debug', () => {
debug({ debug({
name, name,
}) })
return () => ( return () => h('div', name.value)
h('div', name.value)
)
}, },
mounted() { mounted() {
instance = getCurrentInstance()! instance = getCurrentInstance()!
@ -48,9 +49,7 @@ describe('debug', () => {
debug({ debug({
name, name,
}) })
return () => ( return () => h('div', name.value)
h('div', name.value)
)
}, },
mounted() { mounted() {
instance = getCurrentInstance()! instance = getCurrentInstance()!

View File

@ -1,5 +1,5 @@
import {reactive} from '@vue/reactivity' import { reactive } from '@vue/reactivity'
import {getCurrentInstance} from './component' import { getCurrentInstance } from './component'
/** /**
* this debug function is a helper for watching states in the vue devtool (it runs only in dev mode) * this debug function is a helper for watching states in the vue devtool (it runs only in dev mode)
@ -16,11 +16,15 @@ import {getCurrentInstance} from './component'
* }) * })
* @param states any states you want to see in the vue devtool * @param states any states you want to see in the vue devtool
*/ */
export const debug = __DEV__ ? (states: Record<string, any>) => { export const debug = __DEV__
? (states: Record<string, any>) => {
const instance = getCurrentInstance() const instance = getCurrentInstance()
if (instance) { if (instance) {
instance.setupState = reactive(Object.assign({}, states, instance.setupState)) instance.setupState = reactive(
Object.assign({}, states, instance.setupState),
)
} }
} : (states: Record<string, any>) => { }
: (states: Record<string, any>) => {
// empty // empty
} }