refactor: adjust logic branches

This commit is contained in:
Evan You 2021-03-01 15:45:55 -05:00
parent 7562e72c2b
commit 69304cf166

View File

@ -316,16 +316,15 @@ export const setRef = (
if (!vnode) {
// means unmount
value = null
} else {
} else if (isAsyncWrapper(vnode)) {
// when mounting async components, nothing needs to be done,
// because the template ref is forwarded to inner component
if (isAsyncWrapper(vnode)) return
if (vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT) {
return
} else if (vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT) {
value = vnode.component!.exposed || vnode.component!.proxy
} else {
value = vnode.el
}
}
const { i: owner, r: ref } = rawRef
if (__DEV__ && !owner) {