Jelajahi Sumber

fix(runtime-core): should still do full traverse of stable fragment children in dev + hmr

Evan You 5 tahun lalu
induk
melakukan
dd40ad8fca
1 mengubah file dengan 7 tambahan dan 5 penghapusan
  1. 7 5
      packages/runtime-core/src/renderer.ts

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

@@ -1155,11 +1155,13 @@ function baseCreateRenderer(
           parentSuspense,
           isSVG
         )
-        // #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.
-        // #2134 or if it's a component root, it may also get moved around
-        // as the component is being moved.
-        if (
+        if (__DEV__ && parentComponent && parentComponent.type.__hmrId) {
+          traverseStaticChildren(n1, n2)
+        } else if (
+          // #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.
+          // #2134 or if it's a component root, it may also get moved around
+          // as the component is being moved.
           n2.key != null ||
           (parentComponent && n2 === parentComponent.subTree)
         ) {