-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
Changes from all commits
4dfb851
6b98378
3dc4e44
0723334
235c723
de96c6b
cbd0726
9beeecc
124e158
5bcd2b0
d37c02a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' | ||
|
@@ -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) => { | ||
|
||
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) | ||
} | ||
} |