Skip to content

Commit 11f38d8

Browse files
committed
perf: instance public proxy should never be observed
1 parent 6233608 commit 11f38d8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/runtime-core/src/component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {
44
ReactiveEffect,
55
pauseTracking,
66
resetTracking,
7-
shallowReadonly
7+
shallowReadonly,
8+
markRaw
89
} from '@vue/reactivity'
910
import {
1011
ComponentPublicInstance,
@@ -462,7 +463,8 @@ function setupStatefulComponent(
462463
// 0. create render proxy property access cache
463464
instance.accessCache = {}
464465
// 1. create public instance / render proxy
465-
instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers)
466+
// also mark it raw so it's never observed
467+
instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers))
466468
if (__DEV__) {
467469
exposePropsOnRenderContext(instance)
468470
}

0 commit comments

Comments
 (0)