]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): adjust force diff of dev root fragments
authorEvan You <yyx990803@gmail.com>
Wed, 18 May 2022 08:36:00 +0000 (16:36 +0800)
committerEvan You <yyx990803@gmail.com>
Wed, 18 May 2022 08:36:00 +0000 (16:36 +0800)
fix #5946

packages/runtime-core/src/renderer.ts

index 8af783a20c9f6f05d3329f01852bcec9de4b81e8..1f3c2a918d4fd30a11d0f35695eb63a65a400097 100644 (file)
@@ -1064,8 +1064,12 @@ function baseCreateRenderer(
 
     let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2
 
-    if (__DEV__ && isHmrUpdating) {
-      // HMR updated, force full diff
+    if (
+      __DEV__ &&
+      // #5523 dev root fragment may inherit directives
+      (isHmrUpdating || patchFlag & PatchFlags.DEV_ROOT_FRAGMENT)
+    ) {
+      // HMR updated / Dev root fragment (w/ comments), force full diff
       patchFlag = 0
       optimized = false
       dynamicChildren = null
@@ -1098,8 +1102,6 @@ function baseCreateRenderer(
       if (
         patchFlag > 0 &&
         patchFlag & PatchFlags.STABLE_FRAGMENT &&
-        // #5523 dev root fragment may inherit directives so always force update
-        !(__DEV__ && patchFlag & PatchFlags.DEV_ROOT_FRAGMENT) &&
         dynamicChildren &&
         // #2715 the previous fragment could've been a BAILed one as a result
         // of renderSlot() with no valid children