Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(runtime-core): disable tracking block in h function #8213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
edison1105 merged 11 commits into vuejs:main from edison1105:fix/hFn
Sep 2, 2025
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
19 changes: 15 additions & 4 deletions packages/runtime-core/src/h.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
type VNodeProps,
createVNode,
isVNode,
setBlockTracking,
} from './vnode'
import type { Teleport, TeleportProps } from './components/Teleport'
import type { Suspense, SuspenseProps } from './components/Suspense'
Expand Down Expand Up @@ -201,25 +202,35 @@ 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) => {
Copy link

@spaceemotion spaceemotion Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just stumbled upon this as I was reading the changelog. Is there a reason why every call to h will now (afaik) create an inline version of doCreateVNode? Can't this be created outside of the scope of calling h()?

Copy link
Member Author

@edison1105 edison1105 Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I made some simplifications to the h function and removed the doCreateVNode function. See #13841

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 createVNode(type, null, [propsOrChildren])
return doCreateVNode(type, null, [propsOrChildren])
}
// props without children
return createVNode(type, propsOrChildren)
return doCreateVNode(type, propsOrChildren)
} else {
// omit props
return createVNode(type, null, propsOrChildren)
return doCreateVNode(type, null, propsOrChildren)
}
} else {
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)
}
}
Loading

AltStyle によって変換されたページ (->オリジナル) /