|
7 | 7 | type VNodeProps, |
8 | 8 | createVNode, |
9 | 9 | isVNode, |
| 10 | + setBlockTracking, |
10 | 11 | } from './vnode' |
11 | 12 | import type { Teleport, TeleportProps } from './components/Teleport' |
12 | 13 | import type { Suspense, SuspenseProps } from './components/Suspense' |
@@ -201,25 +202,35 @@ export function h<P>( |
201 | 202 |
|
202 | 203 | // Actual implementation |
203 | 204 | export function h(type: any, propsOrChildren?: any, children?: any): VNode { |
| 205 | + // #6913 disable tracking block in h function |
| 206 | + const doCreateVNode = (type: any, props?: any, children?: any) => { |
| 207 | + setBlockTracking(-1) |
| 208 | + try { |
| 209 | + return createVNode(type, props, children) |
| 210 | + } finally { |
| 211 | + setBlockTracking(1) |
| 212 | + } |
| 213 | + } |
| 214 | + |
204 | 215 | const l = arguments.length |
205 | 216 | if (l === 2) { |
206 | 217 | if (isObject(propsOrChildren) && !isArray(propsOrChildren)) { |
207 | 218 | // single vnode without props |
208 | 219 | if (isVNode(propsOrChildren)) { |
209 | | - return createVNode(type, null, [propsOrChildren]) |
| 220 | + return doCreateVNode(type, null, [propsOrChildren]) |
210 | 221 | } |
211 | 222 | // props without children |
212 | | - return createVNode(type, propsOrChildren) |
| 223 | + return doCreateVNode(type, propsOrChildren) |
213 | 224 | } else { |
214 | 225 | // omit props |
215 | | - return createVNode(type, null, propsOrChildren) |
| 226 | + return doCreateVNode(type, null, propsOrChildren) |
216 | 227 | } |
217 | 228 | } else { |
218 | 229 | if (l > 3) { |
219 | 230 | children = Array.prototype.slice.call(arguments, 2) |
220 | 231 | } else if (l === 3 && isVNode(children)) { |
221 | 232 | children = [children] |
222 | 233 | } |
223 | | - return createVNode(type, propsOrChildren, children) |
| 234 | + return doCreateVNode(type, propsOrChildren, children) |
224 | 235 | } |
225 | 236 | } |
0 commit comments