@@ -20,7 +20,13 @@ import {
20
20
DirectiveArguments ,
21
21
createVNodeCall
22
22
} from '../ast'
23
- import { PatchFlags , PatchFlagNames , isSymbol , isOn } from '@vue/shared'
23
+ import {
24
+ PatchFlags ,
25
+ PatchFlagNames ,
26
+ isSymbol ,
27
+ isOn ,
28
+ isObject
29
+ } from '@vue/shared'
24
30
import { createCompilerError , ErrorCodes } from '../errors'
25
31
import {
26
32
RESOLVE_DIRECTIVE ,
@@ -68,6 +74,8 @@ export const transformElement: NodeTransform = (node, context) => {
68
74
const vnodeTag = isComponent
69
75
? resolveComponentType ( node as ComponentNode , context )
70
76
: `"${ tag } "`
77
+ const isDynamicComponent =
78
+ isObject ( vnodeTag ) && vnodeTag . callee === RESOLVE_DYNAMIC_COMPONENT
71
79
72
80
let vnodeProps : VNodeCall [ 'props' ]
73
81
let vnodeChildren : VNodeCall [ 'children' ]
@@ -78,15 +86,17 @@ export const transformElement: NodeTransform = (node, context) => {
78
86
let vnodeDirectives : VNodeCall [ 'directives' ]
79
87
80
88
let shouldUseBlock =
81
- ! isComponent &&
82
- // <svg> and <foreignObject> must be forced into blocks so that block
83
- // updates inside get proper isSVG flag at runtime. (#639, #643)
84
- // This is technically web-specific, but splitting the logic out of core
85
- // leads to too much unnecessary complexity.
86
- ( tag === 'svg' ||
87
- tag === 'foreignObject' ||
88
- // #938: elements with dynamic keys should be forced into blocks
89
- findProp ( node , 'key' , true ) )
89
+ // dynamic component may resolve to plain elements
90
+ isDynamicComponent ||
91
+ ( ! isComponent &&
92
+ // <svg> and <foreignObject> must be forced into blocks so that block
93
+ // updates inside get proper isSVG flag at runtime. (#639, #643)
94
+ // This is technically web-specific, but splitting the logic out of core
95
+ // leads to too much unnecessary complexity.
96
+ ( tag === 'svg' ||
97
+ tag === 'foreignObject' ||
98
+ // #938: elements with dynamic keys should be forced into blocks
99
+ findProp ( node , 'key' , true ) ) )
90
100
91
101
// props
92
102
if ( props . length > 0 ) {
0 commit comments