@@ -290,7 +290,7 @@ export const createVNode = (__DEV__
290
290
: _createVNode ) as typeof _createVNode
291
291
292
292
function _createVNode (
293
- type : VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT ,
293
+ type : VNode | VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT ,
294
294
props : ( Data & VNodeProps ) | null = null ,
295
295
children : unknown = null ,
296
296
patchFlag : number = 0 ,
@@ -304,6 +304,10 @@ function _createVNode(
304
304
type = Comment
305
305
}
306
306
307
+ if ( isVNode ( type ) ) {
308
+ return cloneVNode ( type , props , children )
309
+ }
310
+
307
311
// class component normalization.
308
312
if ( isFunction ( type ) && '__vccOpts' in type ) {
309
313
type = type . __vccOpts
@@ -406,7 +410,8 @@ function _createVNode(
406
410
407
411
export function cloneVNode < T , U > (
408
412
vnode : VNode < T , U > ,
409
- extraProps ?: Data & VNodeProps
413
+ extraProps ?: Data & VNodeProps | null ,
414
+ children ?: unknown
410
415
) : VNode < T , U > {
411
416
const props = extraProps
412
417
? vnode . props
@@ -415,7 +420,7 @@ export function cloneVNode<T, U>(
415
420
: vnode . props
416
421
// This is intentionally NOT using spread or extend to avoid the runtime
417
422
// key enumeration cost.
418
- return {
423
+ const cloned : VNode < T , U > = {
419
424
__v_isVNode : true ,
420
425
__v_skip : true ,
421
426
type : vnode . type ,
@@ -452,6 +457,10 @@ export function cloneVNode<T, U>(
452
457
el : vnode . el ,
453
458
anchor : vnode . anchor
454
459
}
460
+ if ( children ) {
461
+ normalizeChildren ( cloned , children )
462
+ }
463
+ return cloned
455
464
}
456
465
457
466
/**
0 commit comments