@@ -396,9 +396,6 @@ export interface ComponentInternalInstance {
396
396
refs : Data
397
397
emit : EmitFn
398
398
399
- attrsProxy : Data | null
400
- slotsProxy : Slots | null
401
-
402
399
/**
403
400
* used for keeping track of .once event handlers on components
404
401
* @internal
@@ -599,9 +596,6 @@ export function createComponentInstance(
599
596
setupState : EMPTY_OBJ ,
600
597
setupContext : null ,
601
598
602
- attrsProxy : null ,
603
- slotsProxy : null ,
604
-
605
599
// suspense related
606
600
suspense,
607
601
suspenseId : suspense ? suspense . pendingId : 0 ,
@@ -1042,15 +1036,12 @@ const attrsProxyHandlers = __DEV__
1042
1036
* Dev-only
1043
1037
*/
1044
1038
function 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
+ } )
1054
1045
}
1055
1046
1056
1047
export function createSetupContext (
@@ -1084,6 +1075,7 @@ export function createSetupContext(
1084
1075
// We use getters in dev in case libs like test-utils overwrite instance
1085
1076
// properties (overwrites should not be done in prod)
1086
1077
let attrsProxy : Data
1078
+ let slotsProxy : Slots
1087
1079
return Object . freeze ( {
1088
1080
get attrs ( ) {
1089
1081
return (
@@ -1092,7 +1084,7 @@ export function createSetupContext(
1092
1084
)
1093
1085
} ,
1094
1086
get slots ( ) {
1095
- return getSlotsProxy ( instance )
1087
+ return slotsProxy || ( slotsProxy = getSlotsProxy ( instance ) )
1096
1088
} ,
1097
1089
get emit ( ) {
1098
1090
return ( event : string , ...args : any [ ] ) => instance . emit ( event , ...args )
0 commit comments