@@ -5,6 +5,8 @@ import { emptyVNode } from '../vdom/vnode'
5
5
import { observerState } from '../observer/index'
6
6
import { warn , validateProp , remove , noop } from '../util/index'
7
7
8
+ export let activeInstance : any = null
9
+
8
10
export function initLifecycle ( vm : Component ) {
9
11
const options = vm . $options
10
12
@@ -76,13 +78,16 @@ export function lifecycleMixin (Vue: Class<Component>) {
76
78
callHook ( vm , 'beforeUpdate' )
77
79
}
78
80
const prevEl = vm . $el
81
+ const prevActiveInstance = activeInstance
82
+ activeInstance = vm
79
83
if ( ! vm . _vnode ) {
80
84
// Vue.prototype.__patch__ is injected in entry points
81
85
// based on the rendering backend used.
82
86
vm . $el = vm . __patch__ ( vm . $el , vnode , hydrating )
83
87
} else {
84
88
vm . $el = vm . __patch__ ( vm . _vnode , vnode )
85
89
}
90
+ activeInstance = prevActiveInstance
86
91
vm . _vnode = vnode
87
92
// update __vue__ reference
88
93
if ( prevEl ) {
@@ -107,6 +112,7 @@ export function lifecycleMixin (Vue: Class<Component>) {
107
112
renderChildren : ?VNodeChildren
108
113
) {
109
114
const vm : Component = this
115
+ const hasChildren = ! ! ( vm . $options . _renderChildren || renderChildren )
110
116
vm . $options . _parentVnode = parentVnode
111
117
vm . $options . _renderChildren = renderChildren
112
118
// update props
@@ -131,6 +137,10 @@ export function lifecycleMixin (Vue: Class<Component>) {
131
137
vm . $options . _parentListeners = listeners
132
138
vm . _updateListeners ( listeners , oldListeners )
133
139
}
140
+ // force udpate if has children
141
+ if ( hasChildren ) {
142
+ vm . $forceUpdate ( )
143
+ }
134
144
}
135
145
136
146
Vue . prototype . $forceUpdate = function ( ) {
0 commit comments