MCPcopy
hub / github.com/vuejs/core / injectToKeepAliveRoot

Function injectToKeepAliveRoot

packages/runtime-core/src/components/KeepAlive.ts:460–472  ·  view source on GitHub ↗
(
  hook: Function & { __weh?: Function },
  type: LifecycleHooks,
  target: ComponentInternalInstance,
  keepAliveRoot: ComponentInternalInstance,
)

Source from the content-addressed store, hash-verified

458}
459
460function injectToKeepAliveRoot(
461 hook: Function & { __weh?: Function },
462 type: LifecycleHooks,
463 target: ComponentInternalInstance,
464 keepAliveRoot: ComponentInternalInstance,
465) {
466 // injectHook wraps the original for error handling, so make sure to remove
467 // the wrapped version.
468 const injected = injectHook(type, hook, keepAliveRoot, true /* prepend */)
469 onUnmounted(() => {
470 remove(keepAliveRoot[type]!, injected)
471 }, target)
472}
473
474function resetShapeFlag(vnode: VNode) {
475 // bitwise operations to remove keep alive flags

Callers 1

registerKeepAliveHookFunction · 0.85

Calls 2

injectHookFunction · 0.90
removeFunction · 0.90

Tested by

no test coverage detected