Skip to content

Commit 40ccbde

Browse files
committed
chore: remove refs from setupContext
explicit refs should be preferred
1 parent 4abd8d2 commit 40ccbde

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/runtime-core/src/component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ function finishComponentSetup(
414414
export const SetupProxySymbol = Symbol()
415415

416416
const SetupProxyHandlers: { [key: string]: ProxyHandler<any> } = {}
417-
;['attrs', 'slots', 'refs'].forEach((type: string) => {
417+
;['attrs', 'slots'].forEach((type: string) => {
418418
SetupProxyHandlers[type] = {
419419
get: (instance, key) => instance[type][key],
420420
has: (instance, key) => key === SetupProxySymbol || key in instance[type],
@@ -429,12 +429,11 @@ const SetupProxyHandlers: { [key: string]: ProxyHandler<any> } = {}
429429

430430
function createSetupContext(instance: ComponentInternalInstance): SetupContext {
431431
const context = {
432-
// attrs, slots & refs are non-reactive, but they need to always expose
432+
// attrs & slots are non-reactive, but they need to always expose
433433
// the latest values (instance.xxx may get replaced during updates) so we
434434
// need to expose them through a proxy
435435
attrs: new Proxy(instance, SetupProxyHandlers.attrs),
436436
slots: new Proxy(instance, SetupProxyHandlers.slots),
437-
refs: new Proxy(instance, SetupProxyHandlers.refs),
438437
emit: instance.emit
439438
}
440439
return __DEV__ ? Object.freeze(context) : context

0 commit comments

Comments
 (0)