refactor(runtime-core): remove need for internal instance sink

This commit is contained in:
Evan You
2020-04-16 10:09:13 -04:00
parent 4d014dc3d3
commit 24e5ab33f5
5 changed files with 39 additions and 38 deletions

View File

@@ -53,7 +53,7 @@ import {
SuspenseImpl
} from './components/Suspense'
import { TeleportImpl } from './components/Teleport'
import { KeepAliveSink, isKeepAlive } from './components/KeepAlive'
import { isKeepAlive, KeepAliveContext } from './components/KeepAlive'
import { registerHMR, unregisterHMR } from './hmr'
import {
ErrorCodes,
@@ -949,7 +949,7 @@ function baseCreateRenderer(
) => {
if (n1 == null) {
if (n2.shapeFlag & ShapeFlags.COMPONENT_KEPT_ALIVE) {
;(parentComponent!.sink as KeepAliveSink).activate(
;(parentComponent!.proxyTarget as KeepAliveContext).activate(
n2,
container,
anchor,
@@ -998,9 +998,7 @@ function baseCreateRenderer(
// inject renderer internals for keepAlive
if (isKeepAlive(initialVNode)) {
const sink = instance.sink as KeepAliveSink
sink.renderer = internals
sink.parentSuspense = parentSuspense
;(instance.proxyTarget as KeepAliveContext).renderer = internals
}
// resolve props and slots for setup context
@@ -1721,7 +1719,7 @@ function baseCreateRenderer(
if (shapeFlag & ShapeFlags.COMPONENT) {
if (shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE) {
;(parentComponent!.sink as KeepAliveSink).deactivate(vnode)
;(parentComponent!.proxyTarget as KeepAliveContext).deactivate(vnode)
} else {
unmountComponent(vnode.component!, parentSuspense, doRemove)
}