Skip to content

Commit b46baac

Browse files
committed
always update abstract components
1 parent 1bb7830 commit b46baac

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

Diff for: src/core/components/keep-alive.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getRealChild } from 'core/vdom/helpers'
33

44
export default {
55
name: 'keep-alive',
6-
_abstract: true,
6+
abstract: true,
77
props: {
88
child: Object
99
},

Diff for: src/core/instance/lifecycle.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export function initLifecycle (vm: Component) {
1010

1111
// locate first non-abstract parent
1212
let parent = options.parent
13-
if (parent && !options._abstract) {
14-
while (parent.$options._abstract && parent.$parent) {
13+
if (parent && !options.abstract) {
14+
while (parent.$options.abstract && parent.$parent) {
1515
parent = parent.$parent
1616
}
1717
parent.$children.push(vm)
@@ -154,7 +154,7 @@ export function lifecycleMixin (Vue: Class<Component>) {
154154
vm._isBeingDestroyed = true
155155
// remove self from parent
156156
const parent = vm.$parent
157-
if (parent && !parent._isBeingDestroyed && !vm.$options._abstract) {
157+
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
158158
remove(parent.$children, vm)
159159
}
160160
// teardown watchers

Diff for: src/core/vdom/create-component.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,17 @@ function prepatch (
137137
vnode: MountedComponentVNode
138138
) {
139139
const options = vnode.componentOptions
140-
vnode.child = oldVnode.child
141-
vnode.child._updateFromParent(
140+
const child = vnode.child = oldVnode.child
141+
child._updateFromParent(
142142
options.propsData, // updated props
143143
options.listeners, // updated listeners
144144
vnode, // new parent vnode
145145
options.children // new children
146146
)
147+
// always update abstract components.
148+
if (child.$options.abstract) {
149+
child.$forceUpdate()
150+
}
147151
}
148152

149153
function insert (vnode: MountedComponentVNode) {

Diff for: src/core/vdom/helpers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function applyNS (vnode, ns) {
6666
// we want to recrusively retrieve the real component to be rendered
6767
export function getRealChild (vnode: ?VNode): ?VNode {
6868
const compOptions = vnode && vnode.componentOptions
69-
if (compOptions && compOptions.Ctor.options._abstract) {
69+
if (compOptions && compOptions.Ctor.options.abstract) {
7070
return getRealChild(compOptions.propsData && compOptions.propsData.child)
7171
} else {
7272
return vnode

Diff for: src/platforms/web/runtime/components/transition.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function extractTransitionData (comp: Component): Object {
3939
export default {
4040
name: 'transition',
4141
props: transitionProps,
42-
_abstract: true,
42+
abstract: true,
4343
render (h: Function) {
4444
let children = this.$slots.default
4545
if (!children) {

0 commit comments

Comments
 (0)