]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): skip patchBlockChildren if n1.dynamicChildren is null (#2717)
authoredison <daiwei521@126.com>
Thu, 3 Dec 2020 17:17:04 +0000 (01:17 +0800)
committerGitHub <noreply@github.com>
Thu, 3 Dec 2020 17:17:04 +0000 (12:17 -0500)
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.

packages/runtime-core/src/renderer.ts

index 646631507d4743236be633ea5c28ec41828d9364..3baaf2405ea5dbd926905db5777bc1c0c078c76d 100644 (file)
@@ -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,