fix(compiler): cache handlers should be per-instance, fix hoist w/ cached handlers

This commit is contained in:
Evan You
2019-10-20 17:00:11 -04:00
parent 39157f7671
commit 869ae19c41
9 changed files with 63 additions and 59 deletions

View File

@@ -83,7 +83,11 @@ export interface ComponentInternalInstance {
render: RenderFunction | null
effects: ReactiveEffect[] | null
provides: Data
accessCache: Data
// cache for renderProxy access type to avoid hasOwnProperty calls
accessCache: Data | null
// cache for render function values that rely on _ctx but won't need updates
// after initialized (e.g. inline handlers)
renderCache: any[] | null
components: Record<string, Component>
directives: Record<string, Directive>
@@ -149,6 +153,7 @@ export function createComponentInstance(
effects: null,
provides: parent ? parent.provides : Object.create(appContext.provides),
accessCache: null!,
renderCache: null,
// setup context properties
renderContext: EMPTY_OBJ,