File tree 4 files changed +16
-10
lines changed
4 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -113,11 +113,6 @@ export function renderComponentRoot(
113
113
root . shapeFlag & ShapeFlags . COMPONENT
114
114
) {
115
115
root = cloneVNode ( root , fallthroughAttrs )
116
- // If the child root node is a compiler optimized vnode, make sure it
117
- // force update full props to account for the merged attrs.
118
- if ( root . dynamicChildren ) {
119
- root . patchFlag |= PatchFlags . FULL_PROPS
120
- }
121
116
} else if ( __DEV__ && ! accessedAttrs && root . type !== Comment ) {
122
117
const allAttrs = Object . keys ( attrs )
123
118
const eventAttrs : string [ ] = [ ]
Original file line number Diff line number Diff line change @@ -354,6 +354,11 @@ function baseCreateRenderer(
354
354
n1 = null
355
355
}
356
356
357
+ if ( n2 . patchFlag === PatchFlags . BAIL ) {
358
+ optimized = false
359
+ n2 . dynamicChildren = null
360
+ }
361
+
357
362
const { type, ref, shapeFlag } = n2
358
363
switch ( type ) {
359
364
case Text :
@@ -1280,9 +1285,6 @@ function baseCreateRenderer(
1280
1285
const c2 = n2 . children
1281
1286
1282
1287
const { patchFlag, shapeFlag } = n2
1283
- if ( patchFlag === PatchFlags . BAIL ) {
1284
- optimized = false
1285
- }
1286
1288
// fast path
1287
1289
if ( patchFlag > 0 ) {
1288
1290
if ( patchFlag & PatchFlags . KEYED_FRAGMENT ) {
Original file line number Diff line number Diff line change @@ -412,7 +412,15 @@ export function cloneVNode<T, U>(
412
412
target : vnode . target ,
413
413
targetAnchor : vnode . targetAnchor ,
414
414
shapeFlag : vnode . shapeFlag ,
415
- patchFlag : vnode . patchFlag ,
415
+ // if the vnode is cloned with extra props, we can no longer assume its
416
+ // existing patch flag to be reliable and need to bail out of optimized mode.
417
+ // however we don't want block nodes to de-opt their children, so if the
418
+ // vnode is a block node, we only add the FULL_PROPS flag to it.
419
+ patchFlag : extraProps
420
+ ? vnode . dynamicChildren
421
+ ? vnode . patchFlag | PatchFlags . FULL_PROPS
422
+ : PatchFlags . BAIL
423
+ : vnode . patchFlag ,
416
424
dynamicProps : vnode . dynamicProps ,
417
425
dynamicChildren : vnode . dynamicChildren ,
418
426
appContext : vnode . appContext ,
Original file line number Diff line number Diff line change @@ -76,9 +76,10 @@ export const enum PatchFlags {
76
76
HOISTED = - 1 ,
77
77
78
78
// A special flag that indicates that the diffing algorithm should bail out
79
- // of optimized mode. This is only on block fragments created by renderSlot()
79
+ // of optimized mode. For example, on block fragments created by renderSlot()
80
80
// when encountering non-compiler generated slots (i.e. manually written
81
81
// render functions, which should always be fully diffed)
82
+ // OR manually cloneVNodes
82
83
BAIL = - 2
83
84
}
84
85
You can’t perform that action at this time.
0 commit comments