@@ -396,9 +396,6 @@ export interface ComponentInternalInstance {
396396 refs : Data
397397 emit : EmitFn
398398
399- attrsProxy : Data | null
400- slotsProxy : Slots | null
401-
402399 /**
403400 * used for keeping track of .once event handlers on components
404401 * @internal
@@ -599,9 +596,6 @@ export function createComponentInstance(
599596 setupState : EMPTY_OBJ ,
600597 setupContext : null ,
601598
602- attrsProxy : null ,
603- slotsProxy : null ,
604-
605599 // suspense related
606600 suspense,
607601 suspenseId : suspense ? suspense . pendingId : 0 ,
@@ -1042,15 +1036,12 @@ const attrsProxyHandlers = __DEV__
10421036 * Dev-only
10431037 */
10441038function getSlotsProxy ( instance : ComponentInternalInstance ) : Slots {
1045- return (
1046- instance . slotsProxy ||
1047- ( instance . slotsProxy = new Proxy ( instance . slots , {
1048- get ( target , key : string ) {
1049- track ( instance , TrackOpTypes . GET , '$slots' )
1050- return target [ key ]
1051- } ,
1052- } ) )
1053- )
1039+ return new Proxy ( instance . slots , {
1040+ get ( target , key : string ) {
1041+ track ( instance , TrackOpTypes . GET , '$slots' )
1042+ return target [ key ]
1043+ } ,
1044+ } )
10541045}
10551046
10561047export function createSetupContext (
@@ -1084,6 +1075,7 @@ export function createSetupContext(
10841075 // We use getters in dev in case libs like test-utils overwrite instance
10851076 // properties (overwrites should not be done in prod)
10861077 let attrsProxy : Data
1078+ let slotsProxy : Slots
10871079 return Object . freeze ( {
10881080 get attrs ( ) {
10891081 return (
@@ -1092,7 +1084,7 @@ export function createSetupContext(
10921084 )
10931085 } ,
10941086 get slots ( ) {
1095- return getSlotsProxy ( instance )
1087+ return slotsProxy || ( slotsProxy = getSlotsProxy ( instance ) )
10961088 } ,
10971089 get emit ( ) {
10981090 return ( event : string , ...args : any [ ] ) => instance . emit ( event , ...args )
0 commit comments