test: more tests for keep-alive

This commit is contained in:
Evan You
2019-10-30 23:32:29 -04:00
parent 5fcb81050a
commit 4631f5323b
3 changed files with 340 additions and 20 deletions

View File

@@ -901,7 +901,11 @@ export function createRenderer<
queuePostRenderEffect(instance.m, parentSuspense)
}
// activated hook for keep-alive roots.
if (instance.a !== null) {
if (
instance.a !== null &&
instance.vnode.shapeFlag &
ShapeFlags.STATEFUL_COMPONENT_SHOULD_KEEP_ALIVE
) {
queuePostRenderEffect(instance.a, parentSuspense)
}
mounted = true
@@ -1477,7 +1481,11 @@ export function createRenderer<
queuePostRenderEffect(um, parentSuspense)
}
// deactivated hook
if (da !== null && !isDeactivated) {
if (
da !== null &&
!isDeactivated &&
instance.vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT_SHOULD_KEEP_ALIVE
) {
queuePostRenderEffect(da, parentSuspense)
}
queuePostFlushCb(() => {