Skip to content

Commit 056ef2a

Browse files
committed
refactor: use markRaw instead of internal flag check
1 parent b228abb commit 056ef2a

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

packages/runtime-core/src/component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {
44
pauseTracking,
55
resetTracking,
66
shallowReadonly,
7-
proxyRefs
7+
proxyRefs,
8+
markRaw
89
} from '@vue/reactivity'
910
import {
1011
ComponentPublicInstance,
@@ -597,7 +598,7 @@ function setupStatefulComponent(
597598
instance.accessCache = Object.create(null)
598599
// 1. create public instance / render proxy
599600
// also mark it raw so it's never observed
600-
instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers)
601+
instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers))
601602
if (__DEV__) {
602603
exposePropsOnRenderContext(instance)
603604
}

packages/runtime-core/src/componentPublicInstance.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
ReactiveEffect,
1919
toRaw,
2020
shallowReadonly,
21-
ReactiveFlags,
2221
track,
2322
TrackOpTypes,
2423
ShallowUnwrapRef,
@@ -268,11 +267,6 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
268267
appContext
269268
} = instance
270269

271-
// let @vue/reactivity know it should never observe Vue public instances.
272-
if (key === ReactiveFlags.SKIP) {
273-
return true
274-
}
275-
276270
// for internal formatters to know that this is a Vue instance
277271
if (__DEV__ && key === '__isVue') {
278272
return true

0 commit comments

Comments
 (0)