From: Evan You Date: Thu, 18 Oct 2018 21:49:11 +0000 (-0400) Subject: fix: KeepAlive state should be non-reactive X-Git-Tag: v3.0.0-alpha.0~1091 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a428218c6440e12e37af14054d0c8027c7987cd8;p=thirdparty%2Fvuejs%2Fcore.git fix: KeepAlive state should be non-reactive --- diff --git a/packages/core/src/optional/keepAlive.ts b/packages/core/src/optional/keepAlive.ts index fa973928d4..8359588363 100644 --- a/packages/core/src/optional/keepAlive.ts +++ b/packages/core/src/optional/keepAlive.ts @@ -18,8 +18,13 @@ type Cache = Map export const KeepAliveSymbol = Symbol() export class KeepAlive extends Component { - cache: Cache = new Map() - keys: Set = new Set() + private cache: Cache + private keys: Set + + created() { + this.cache = new Map() + this.keys = new Set() + } // to be set in createRenderer when instance is created $unmount: (instance: ComponentInstance) => void @@ -63,9 +68,6 @@ export class KeepAlive extends Component { } return children } else if ((vnode.flags & VNodeFlags.COMPONENT_STATEFUL) === 0) { - if (__DEV__) { - warn(`KeepAlive child must be a stateful component.`) - } return children }