File tree 2 files changed +5
-11
lines changed
2 files changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -93,10 +93,12 @@ describe('compiler: v-if', () => {
93
93
expect ( ( node . branches [ 0 ] . children [ 0 ] as ElementNode ) . tagType ) . toBe (
94
94
ElementTypes . COMPONENT
95
95
)
96
+ // #2058 since a component may fail to resolve and fallback to a plain
97
+ // element, it still needs to be made a block
96
98
expect (
97
99
( ( node . branches [ 0 ] . children [ 0 ] as ElementNode ) !
98
100
. codegenNode as VNodeCall ) ! . isBlock
99
- ) . toBe ( false )
101
+ ) . toBe ( true )
100
102
} )
101
103
102
104
test ( 'v-if + v-else' , ( ) => {
Original file line number Diff line number Diff line change @@ -29,8 +29,7 @@ import {
29
29
CREATE_BLOCK ,
30
30
FRAGMENT ,
31
31
CREATE_COMMENT ,
32
- OPEN_BLOCK ,
33
- TELEPORT
32
+ OPEN_BLOCK
34
33
} from '../runtimeHelpers'
35
34
import { injectProp , findDir , findProp } from '../utils'
36
35
import { PatchFlags , PatchFlagNames } from '@vue/shared'
@@ -255,14 +254,7 @@ function createChildrenCodegenNode(
255
254
const vnodeCall = ( firstChild as ElementNode )
256
255
. codegenNode as BlockCodegenNode
257
256
// Change createVNode to createBlock.
258
- if (
259
- vnodeCall . type === NodeTypes . VNODE_CALL &&
260
- // component vnodes are always tracked and its children are
261
- // compiled into slots so no need to make it a block
262
- ( ( firstChild as ElementNode ) . tagType !== ElementTypes . COMPONENT ||
263
- // teleport has component type but isn't always tracked
264
- vnodeCall . tag === TELEPORT )
265
- ) {
257
+ if ( vnodeCall . type === NodeTypes . VNODE_CALL ) {
266
258
vnodeCall . isBlock = true
267
259
helper ( OPEN_BLOCK )
268
260
helper ( CREATE_BLOCK )
You can’t perform that action at this time.
0 commit comments