test: tests for keep-alive
This commit is contained in:
@@ -863,6 +863,7 @@ export function createRenderer<
|
||||
|
||||
setupRenderEffect(
|
||||
instance,
|
||||
parentComponent,
|
||||
parentSuspense,
|
||||
initialVNode,
|
||||
container,
|
||||
@@ -877,6 +878,7 @@ export function createRenderer<
|
||||
|
||||
function setupRenderEffect(
|
||||
instance: ComponentInternalInstance,
|
||||
parentComponent: ComponentInternalInstance | null,
|
||||
parentSuspense: HostSuspenseBoundary | null,
|
||||
initialVNode: HostVNode,
|
||||
container: HostElement,
|
||||
@@ -898,6 +900,10 @@ export function createRenderer<
|
||||
if (instance.m !== null) {
|
||||
queuePostRenderEffect(instance.m, parentSuspense)
|
||||
}
|
||||
// activated hook for keep-alive roots.
|
||||
if (instance.a !== null) {
|
||||
queuePostRenderEffect(instance.a, parentSuspense)
|
||||
}
|
||||
mounted = true
|
||||
} else {
|
||||
// updateComponent
|
||||
@@ -1450,7 +1456,7 @@ export function createRenderer<
|
||||
parentSuspense: HostSuspenseBoundary | null,
|
||||
doRemove?: boolean
|
||||
) {
|
||||
const { bum, effects, update, subTree, um } = instance
|
||||
const { bum, effects, update, subTree, um, da, isDeactivated } = instance
|
||||
// beforeUnmount hook
|
||||
if (bum !== null) {
|
||||
invokeHooks(bum)
|
||||
@@ -1470,6 +1476,10 @@ export function createRenderer<
|
||||
if (um !== null) {
|
||||
queuePostRenderEffect(um, parentSuspense)
|
||||
}
|
||||
// deactivated hook
|
||||
if (da !== null && !isDeactivated) {
|
||||
queuePostRenderEffect(da, parentSuspense)
|
||||
}
|
||||
queuePostFlushCb(() => {
|
||||
instance.isUnmounted = true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user