refactor: remove unused inheritRef option

This is technically a breaking change, but the option was not meant for public use
and ended up not solving the problem it was introduced for.
This commit is contained in:
Evan You
2020-06-30 21:47:12 -04:00
parent 5c490f1c45
commit 7886c267f7
6 changed files with 22 additions and 23 deletions

View File

@@ -108,8 +108,6 @@ export function useTransitionState(): TransitionState {
const BaseTransitionImpl = {
name: `BaseTransition`,
inheritRef: true,
props: {
mode: String,
appear: Boolean,
@@ -135,11 +133,11 @@ const BaseTransitionImpl = {
const instance = getCurrentInstance()!
const state = useTransitionState()
let prevTransitionKey: any
return () => {
const children = slots.default && getTransitionRawChildren(
slots.default(),
true
)
const children =
slots.default && getTransitionRawChildren(slots.default(), true)
if (!children || !children.length) {
return
}
@@ -183,11 +181,24 @@ const BaseTransitionImpl = {
const oldChild = instance.subTree
const oldInnerChild = oldChild && getKeepAliveChild(oldChild)
let transitionKeyChanged = false
const { getTransitionKey } = innerChild.type as any
if (getTransitionKey) {
const key = getTransitionKey()
if (prevTransitionKey === undefined) {
prevTransitionKey = key
} else if (key !== prevTransitionKey) {
prevTransitionKey = key
transitionKeyChanged = true
}
}
// handle mode
if (
oldInnerChild &&
oldInnerChild.type !== Comment &&
!isSameVNodeType(innerChild, oldInnerChild)
(!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)
) {
const leavingHooks = resolveTransitionHooks(
oldInnerChild,