@@ -108,8 +108,6 @@ export function useTransitionState(): TransitionState {
108
108
const BaseTransitionImpl = {
109
109
name : `BaseTransition` ,
110
110
111
- inheritRef : true ,
112
-
113
111
props : {
114
112
mode : String ,
115
113
appear : Boolean ,
@@ -135,11 +133,11 @@ const BaseTransitionImpl = {
135
133
const instance = getCurrentInstance ( ) !
136
134
const state = useTransitionState ( )
137
135
136
+ let prevTransitionKey : any
137
+
138
138
return ( ) => {
139
- const children = slots . default && getTransitionRawChildren (
140
- slots . default ( ) ,
141
- true
142
- )
139
+ const children =
140
+ slots . default && getTransitionRawChildren ( slots . default ( ) , true )
143
141
if ( ! children || ! children . length ) {
144
142
return
145
143
}
@@ -183,11 +181,24 @@ const BaseTransitionImpl = {
183
181
184
182
const oldChild = instance . subTree
185
183
const oldInnerChild = oldChild && getKeepAliveChild ( oldChild )
184
+
185
+ let transitionKeyChanged = false
186
+ const { getTransitionKey } = innerChild . type as any
187
+ if ( getTransitionKey ) {
188
+ const key = getTransitionKey ( )
189
+ if ( prevTransitionKey === undefined ) {
190
+ prevTransitionKey = key
191
+ } else if ( key !== prevTransitionKey ) {
192
+ prevTransitionKey = key
193
+ transitionKeyChanged = true
194
+ }
195
+ }
196
+
186
197
// handle mode
187
198
if (
188
199
oldInnerChild &&
189
200
oldInnerChild . type !== Comment &&
190
- ! isSameVNodeType ( innerChild , oldInnerChild )
201
+ ( ! isSameVNodeType ( innerChild , oldInnerChild ) || transitionKeyChanged )
191
202
) {
192
203
const leavingHooks = resolveTransitionHooks (
193
204
oldInnerChild ,
0 commit comments