const BaseTransitionImpl = {
name: `BaseTransition`,
- inheritRef: true,
-
props: {
mode: String,
appear: Boolean,
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
}
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,
ComponentInternalInstance,
createComponentInstance,
Data,
- setupComponent,
- Component
+ setupComponent
} from './component'
import {
renderComponentRoot,
if (!vnode) {
value = null
} else {
- const { el, component, shapeFlag, type } = vnode
- if (shapeFlag & ShapeFlags.COMPONENT && (type as Component).inheritRef) {
- return
- }
- if (shapeFlag & ShapeFlags.STATEFUL_COMPONENT) {
- value = component!.proxy
+ if (vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT) {
+ value = vnode.component!.proxy
} else {
- value = el
+ value = vnode.el
}
}