@@ -454,9 +454,6 @@ export interface ComponentInternalInstance {
454
454
refs : Data
455
455
emit : EmitFn
456
456
457
- attrsProxy : Data | null
458
- slotsProxy : Slots | null
459
-
460
457
/**
461
458
* used for keeping track of .once event handlers on components
462
459
* @internal
@@ -659,9 +656,6 @@ export function createComponentInstance(
659
656
setupState : EMPTY_OBJ ,
660
657
setupContext : null ,
661
658
662
- attrsProxy : null ,
663
- slotsProxy : null ,
664
-
665
659
// suspense related
666
660
suspense,
667
661
suspenseId : suspense ? suspense . pendingId : 0 ,
@@ -1104,15 +1098,12 @@ const attrsProxyHandlers = __DEV__
1104
1098
* Dev-only
1105
1099
*/
1106
1100
function getSlotsProxy ( instance : ComponentInternalInstance ) : Slots {
1107
- return (
1108
- instance . slotsProxy ||
1109
- ( instance . slotsProxy = new Proxy ( instance . slots , {
1110
- get ( target , key : string ) {
1111
- track ( instance , TrackOpTypes . GET , '$slots' )
1112
- return target [ key ]
1113
- } ,
1114
- } ) )
1115
- )
1101
+ return new Proxy ( instance . slots , {
1102
+ get ( target , key : string ) {
1103
+ track ( instance , TrackOpTypes . GET , '$slots' )
1104
+ return target [ key ]
1105
+ } ,
1106
+ } )
1116
1107
}
1117
1108
1118
1109
export function createSetupContext (
@@ -1146,6 +1137,7 @@ export function createSetupContext(
1146
1137
// We use getters in dev in case libs like test-utils overwrite instance
1147
1138
// properties (overwrites should not be done in prod)
1148
1139
let attrsProxy : Data
1140
+ let slotsProxy : Slots
1149
1141
return Object . freeze ( {
1150
1142
get attrs ( ) {
1151
1143
return (
@@ -1154,7 +1146,7 @@ export function createSetupContext(
1154
1146
)
1155
1147
} ,
1156
1148
get slots ( ) {
1157
- return getSlotsProxy ( instance )
1149
+ return slotsProxy || ( slotsProxy = getSlotsProxy ( instance ) )
1158
1150
} ,
1159
1151
get emit ( ) {
1160
1152
return ( event : string , ...args : any [ ] ) => instance . emit ( event , ...args )
0 commit comments