@@ -10,6 +10,7 @@ import { installRenderHelpers } from '../instance/render-helpers/index'
1010import {
1111 isDef ,
1212 isTrue ,
13+ hasOwn ,
1314 camelize ,
1415 emptyObject ,
1516 validateProp
@@ -23,6 +24,21 @@ export function FunctionalRenderContext (
2324 Ctor : Class < Component >
2425) {
2526 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+
2642 this . data = data
2743 this . props = props
2844 this . children = children
@@ -31,12 +47,6 @@ export function FunctionalRenderContext (
3147 this . injections = resolveInject ( options . inject , parent )
3248 this . slots = ( ) => resolveSlots ( children , parent )
3349
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-
4050 // support for compiled functional template
4151 if ( isCompiled ) {
4252 // exposing $options for renderStatic()
0 commit comments