refactor: extract remove util
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
import { VNode, cloneVNode, isVNode, VNodeProps } from '../vnode'
|
||||
import { warn } from '../warning'
|
||||
import { onBeforeUnmount, injectHook, onUnmounted } from '../apiLifecycle'
|
||||
import { isString, isArray, ShapeFlags } from '@vue/shared'
|
||||
import { isString, isArray, ShapeFlags, remove } from '@vue/shared'
|
||||
import { watch } from '../apiWatch'
|
||||
import { SuspenseBoundary } from './Suspense'
|
||||
import {
|
||||
@@ -297,7 +297,6 @@ function injectToKeepAliveRoot(
|
||||
) {
|
||||
injectHook(type, hook, keepAliveRoot, true /* prepend */)
|
||||
onUnmounted(() => {
|
||||
const hooks = keepAliveRoot[type]!
|
||||
hooks.splice(hooks.indexOf(hook), 1)
|
||||
remove(keepAliveRoot[type]!, hook)
|
||||
}, target)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user