Просмотр исходного кода

fix(runtime-core): skip patchBlockChildren if n1.dynamicChildren is null (#2717)

fix #2715 

The bug was introduced by #2485 where a compiled slot may result in a bailed Fragment
which then gets its dynamicChildren set to `null` by the renderer.
edison 5 лет назад
Родитель
Сommit
c59897c7b0
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      packages/runtime-core/src/renderer.ts

+ 5 - 2
packages/runtime-core/src/renderer.ts

@@ -1139,12 +1139,15 @@ function baseCreateRenderer(
       if (
         patchFlag > 0 &&
         patchFlag & PatchFlags.STABLE_FRAGMENT &&
-        dynamicChildren
+        dynamicChildren &&
+        // #2715 the previous fragment could've been a BAILed one as a result
+        // of renderSlot() with no valid children
+        n1.dynamicChildren
       ) {
         // a stable fragment (template root or <template v-for>) doesn't need to
         // patch children order, but it may contain dynamicChildren.
         patchBlockChildren(
-          n1.dynamicChildren!,
+          n1.dynamicChildren,
           dynamicChildren,
           container,
           parentComponent,