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

Commit 75220c7

Browse files
fix(runtime-core): simplify block-tracking disabling in h() (#13841)
1 parent 4b6cb1f commit 75220c7

File tree

1 file changed

+22
-26
lines changed
  • packages/runtime-core/src

1 file changed

+22
-26
lines changed

‎packages/runtime-core/src/h.ts

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -202,35 +202,31 @@ export function h<P>(
202202

203203
// Actual implementation
204204
export function h(type: any, propsOrChildren?: any, children?: any): VNode {
205-
// #6913 disable tracking block in h function
206-
constdoCreateVNode=(type: any,props?: any,children?: any)=>{
205+
try{
206+
// #6913 disable tracking block in h function
207207
setBlockTracking(-1)
208-
try {
209-
return createVNode(type, props, children)
210-
} finally {
211-
setBlockTracking(1)
212-
}
213-
}
214-
215-
const l = arguments.length
216-
if (l === 2) {
217-
if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
218-
// single vnode without props
219-
if (isVNode(propsOrChildren)) {
220-
return doCreateVNode(type, null, [propsOrChildren])
208+
const l = arguments.length
209+
if (l === 2) {
210+
if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
211+
// single vnode without props
212+
if (isVNode(propsOrChildren)) {
213+
return createVNode(type, null, [propsOrChildren])
214+
}
215+
// props without children
216+
return createVNode(type, propsOrChildren)
217+
} else {
218+
// omit props
219+
return createVNode(type, null, propsOrChildren)
221220
}
222-
// props without children
223-
return doCreateVNode(type, propsOrChildren)
224221
} else {
225-
// omit props
226-
return doCreateVNode(type, null, propsOrChildren)
227-
}
228-
} else {
229-
if (l > 3) {
230-
children = Array.prototype.slice.call(arguments, 2)
231-
} else if (l === 3 && isVNode(children)) {
232-
children = [children]
222+
if (l > 3) {
223+
children = Array.prototype.slice.call(arguments, 2)
224+
} else if (l === 3 && isVNode(children)) {
225+
children = [children]
226+
}
227+
return createVNode(type, propsOrChildren, children)
233228
}
234-
return doCreateVNode(type, propsOrChildren, children)
229+
} finally {
230+
setBlockTracking(1)
235231
}
236232
}

0 commit comments

Comments
(0)

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