@@ -41,7 +41,9 @@ export interface KeepAliveSink {
41
41
activate : (
42
42
vnode : VNode ,
43
43
container : RendererElement ,
44
- anchor : RendererNode | null
44
+ anchor : RendererNode | null ,
45
+ isSVG : boolean ,
46
+ optimized : boolean
45
47
) => void
46
48
deactivate : ( vnode : VNode ) => void
47
49
}
@@ -78,6 +80,7 @@ const KeepAliveImpl = {
78
80
const sink = instance . sink as KeepAliveSink
79
81
const {
80
82
renderer : {
83
+ p : patch ,
81
84
m : move ,
82
85
um : _unmount ,
83
86
o : { createElement }
@@ -86,13 +89,24 @@ const KeepAliveImpl = {
86
89
} = sink
87
90
const storageContainer = createElement ( 'div' )
88
91
89
- sink . activate = ( vnode , container , anchor ) => {
92
+ sink . activate = ( vnode , container , anchor , isSVG , optimized ) => {
93
+ const child = vnode . component !
90
94
move ( vnode , container , anchor , MoveType . ENTER , parentSuspense )
95
+ // in case props have changed
96
+ patch (
97
+ child . vnode ,
98
+ vnode ,
99
+ container ,
100
+ anchor ,
101
+ instance ,
102
+ parentSuspense ,
103
+ isSVG ,
104
+ optimized
105
+ )
91
106
queuePostRenderEffect ( ( ) => {
92
- const component = vnode . component !
93
- component . isDeactivated = false
94
- if ( component . a ) {
95
- invokeHooks ( component . a )
107
+ child . isDeactivated = false
108
+ if ( child . a ) {
109
+ invokeHooks ( child . a )
96
110
}
97
111
} , parentSuspense )
98
112
}
@@ -181,19 +195,19 @@ const KeepAliveImpl = {
181
195
}
182
196
183
197
const key = vnode . key == null ? comp : vnode . key
184
- const cached = cache . get ( key )
198
+ const cachedVNode = cache . get ( key )
185
199
186
200
// clone vnode if it's reused because we are going to mutate it
187
201
if ( vnode . el ) {
188
202
vnode = cloneVNode ( vnode )
189
203
}
190
204
cache . set ( key , vnode )
191
205
192
- if ( cached ) {
206
+ if ( cachedVNode ) {
193
207
// copy over mounted state
194
- vnode . el = cached . el
195
- vnode . anchor = cached . anchor
196
- vnode . component = cached . component
208
+ vnode . el = cachedVNode . el
209
+ vnode . anchor = cachedVNode . anchor
210
+ vnode . component = cachedVNode . component
197
211
if ( vnode . transition ) {
198
212
// recursively update transition hooks on subTree
199
213
setTransitionHooks ( vnode , vnode . transition ! )
0 commit comments