@@ -10,6 +10,7 @@ import { installRenderHelpers } from '../instance/render-helpers/index'
10
10
import {
11
11
isDef ,
12
12
isTrue ,
13
+ hasOwn ,
13
14
camelize ,
14
15
emptyObject ,
15
16
validateProp
@@ -23,6 +24,21 @@ export function FunctionalRenderContext (
23
24
Ctor : Class < Component >
24
25
) {
25
26
const options = Ctor . options
27
+ // ensure the createElement function in functional components
28
+ // gets a unique context - this is necessary for correct named slot check
29
+ let contextVm
30
+ if ( hasOwn ( parent , '_uid' ) ) {
31
+ contextVm = Object . create ( parent )
32
+ // $flow-disable-line
33
+ contextVm . _original = parent
34
+ } else {
35
+ contextVm = parent
36
+ // $flow-disable-line
37
+ parent = parent . _original
38
+ }
39
+ const isCompiled = isTrue ( options . _compiled )
40
+ const needNormalization = ! isCompiled
41
+
26
42
this . data = data
27
43
this . props = props
28
44
this . children = children
@@ -31,12 +47,6 @@ export function FunctionalRenderContext (
31
47
this . injections = resolveInject ( options . inject , parent )
32
48
this . slots = ( ) => resolveSlots ( children , parent )
33
49
34
- // ensure the createElement function in functional components
35
- // gets a unique context - this is necessary for correct named slot check
36
- const contextVm = Object . create ( parent )
37
- const isCompiled = isTrue ( options . _compiled )
38
- const needNormalization = ! isCompiled
39
-
40
50
// support for compiled functional template
41
51
if ( isCompiled ) {
42
52
// exposing $options for renderStatic()
0 commit comments