Skip to content

Commit

Permalink
perf: instance public proxy should never be observed
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 1, 2020
1 parent 6233608 commit 11f38d8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/runtime-core/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
ReactiveEffect,
pauseTracking,
resetTracking,
shallowReadonly
shallowReadonly,
markRaw
} from '@vue/reactivity'
import {
ComponentPublicInstance,
Expand Down Expand Up @@ -462,7 +463,8 @@ function setupStatefulComponent(
// 0. create render proxy property access cache
instance.accessCache = {}
// 1. create public instance / render proxy
instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers)
// also mark it raw so it's never observed
instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers))
if (__DEV__) {
exposePropsOnRenderContext(instance)
}
Expand Down

0 comments on commit 11f38d8

Please sign in to comment.