]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): ensure root stable fragments inherit elements for moving
authorEvan You <yyx990803@gmail.com>
Wed, 16 Sep 2020 16:18:03 +0000 (12:18 -0400)
committerEvan You <yyx990803@gmail.com>
Wed, 16 Sep 2020 16:18:03 +0000 (12:18 -0400)
fix #2134

packages/runtime-core/src/renderer.ts

index 485dcf15077934ea903cd9c4a1dbc96d2990b777..6d01e3e51474520612a0ae202f62182e9edc1601 100644 (file)
@@ -1157,7 +1157,12 @@ function baseCreateRenderer(
         )
         // #2080 if the stable fragment has a key, it's a <template v-for> that may
         //  get moved around. Make sure all root level vnodes inherit el.
-        if (n2.key != null) {
+        // #2134 or if it's a component root, it may also get moved around
+        // as the component is being moved.
+        if (
+          n2.key != null ||
+          (parentComponent && n2 === parentComponent.subTree)
+        ) {
           traverseStaticChildren(n1, n2, true /* shallow */)
         }
       } else {