]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-core): assign patchFlag for template v-if fragment
authorEvan You <yyx990803@gmail.com>
Tue, 17 Mar 2020 15:36:56 +0000 (11:36 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 17 Mar 2020 15:36:56 +0000 (11:36 -0400)
fix #850

packages/compiler-core/__tests__/__snapshots__/compile.spec.ts.snap
packages/compiler-core/__tests__/transforms/__snapshots__/vIf.spec.ts.snap
packages/compiler-core/src/transforms/vIf.ts

index 409bc20313226af11abaa1784471428d3eba32c0..0534a5eb4d3496dd8133234c6972eafb928d223e 100644 (file)
@@ -16,7 +16,7 @@ return function render(_ctx, _cache) {
         ? (_openBlock(), _createBlock(\\"div\\", { key: 0 }, \\"yes\\"))
         : (_openBlock(), _createBlock(_Fragment, { key: 1 }, [
             _createTextVNode(\\"no\\")
-          ])),
+          ], 64 /* STABLE_FRAGMENT */)),
       (_openBlock(true), _createBlock(_Fragment, null, _renderList(list, (value, index) => {
         return (_openBlock(), _createBlock(\\"div\\", null, [
           _createVNode(\\"span\\", null, _toDisplayString(value + index), 1 /* TEXT */)
@@ -40,7 +40,7 @@ return function render(_ctx, _cache) {
       ? (_openBlock(), _createBlock(\\"div\\", { key: 0 }, \\"yes\\"))
       : (_openBlock(), _createBlock(_Fragment, { key: 1 }, [
           _createTextVNode(\\"no\\")
-        ])),
+        ], 64 /* STABLE_FRAGMENT */)),
     (_openBlock(true), _createBlock(_Fragment, null, _renderList(_ctx.list, (value, index) => {
       return (_openBlock(), _createBlock(\\"div\\", null, [
         _createVNode(\\"span\\", null, _toDisplayString(value + index), 1 /* TEXT */)
@@ -63,7 +63,7 @@ export function render(_ctx, _cache) {
       ? (_openBlock(), _createBlock(\\"div\\", { key: 0 }, \\"yes\\"))
       : (_openBlock(), _createBlock(_Fragment, { key: 1 }, [
           _createTextVNode(\\"no\\")
-        ])),
+        ], 64 /* STABLE_FRAGMENT */)),
     (_openBlock(true), _createBlock(_Fragment, null, _renderList(_ctx.list, (value, index) => {
       return (_openBlock(), _createBlock(\\"div\\", null, [
         _createVNode(\\"span\\", null, _toDisplayString(value + index), 1 /* TEXT */)
index 3bd43610cb5437fa20e0668091d57038db462aef..73184e0a432a9531295238a808e23fc17454f466 100644 (file)
@@ -26,7 +26,7 @@ return function render(_ctx, _cache) {
           _createVNode(\\"div\\"),
           \\"hello\\",
           _createVNode(\\"p\\")
-        ]))
+        ], 64 /* STABLE_FRAGMENT */))
       : _createCommentVNode(\\"v-if\\", true)
   }
 }"
@@ -71,7 +71,7 @@ return function render(_ctx, _cache) {
       ? (_openBlock(), _createBlock(\\"div\\", { key: 0 }))
       : orNot
         ? (_openBlock(), _createBlock(\\"p\\", { key: 1 }))
-        : (_openBlock(), _createBlock(_Fragment, { key: 2 }, [\\"fine\\"]))
+        : (_openBlock(), _createBlock(_Fragment, { key: 2 }, [\\"fine\\"], 64 /* STABLE_FRAGMENT */))
   }
 }"
 `;
index 0c0ecc4ca116c81764002202594c4dedd9201915..5394cb8fd887f31c15fd16f3fbd2e8bd6af6c5c1 100644 (file)
@@ -29,6 +29,7 @@ import {
   OPEN_BLOCK
 } from '../runtimeHelpers'
 import { injectProp } from '../utils'
+import { PatchFlags, PatchFlagNames } from '@vue/shared'
 
 export const transformIf = createStructuralDirectiveTransform(
   /^(if|else|else-if)$/,
@@ -197,7 +198,9 @@ function createChildrenCodegenNode(
         helper(FRAGMENT),
         createObjectExpression([keyProperty]),
         children,
-        undefined,
+        `${PatchFlags.STABLE_FRAGMENT} /* ${
+          PatchFlagNames[PatchFlags.STABLE_FRAGMENT]
+        } */`,
         undefined,
         undefined,
         true,