Skip to content
Merged
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
48 changes: 22 additions & 26 deletions packages/runtime-core/src/h.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,35 +202,31 @@ export function h<P>(

// Actual implementation
export function h(type: any, propsOrChildren?: any, children?: any): VNode {
// #6913 disable tracking block in h function
const doCreateVNode = (type: any, props?: any, children?: any) => {
try {
// #6913 disable tracking block in h function
setBlockTracking(-1)
try {
return createVNode(type, props, children)
} finally {
setBlockTracking(1)
}
}

const l = arguments.length
if (l === 2) {
if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
// single vnode without props
if (isVNode(propsOrChildren)) {
return doCreateVNode(type, null, [propsOrChildren])
const l = arguments.length
if (l === 2) {
if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
// single vnode without props
if (isVNode(propsOrChildren)) {
return createVNode(type, null, [propsOrChildren])
}
// props without children
return createVNode(type, propsOrChildren)
} else {
// omit props
return createVNode(type, null, propsOrChildren)
}
// props without children
return doCreateVNode(type, propsOrChildren)
} else {
// omit props
return doCreateVNode(type, null, propsOrChildren)
}
} else {
if (l > 3) {
children = Array.prototype.slice.call(arguments, 2)
} else if (l === 3 && isVNode(children)) {
children = [children]
if (l > 3) {
children = Array.prototype.slice.call(arguments, 2)
} else if (l === 3 && isVNode(children)) {
children = [children]
}
return createVNode(type, propsOrChildren, children)
}
return doCreateVNode(type, propsOrChildren, children)
} finally {
setBlockTracking(1)
}
}
Loading