@@ -454,9 +454,6 @@ export interface ComponentInternalInstance {
454454 refs : Data
455455 emit : EmitFn
456456
457- attrsProxy : Data | null
458- slotsProxy : Slots | null
459-
460457 /**
461458 * used for keeping track of .once event handlers on components
462459 * @internal
@@ -659,9 +656,6 @@ export function createComponentInstance(
659656 setupState : EMPTY_OBJ ,
660657 setupContext : null ,
661658
662- attrsProxy : null ,
663- slotsProxy : null ,
664-
665659 // suspense related
666660 suspense,
667661 suspenseId : suspense ? suspense . pendingId : 0 ,
@@ -1104,15 +1098,12 @@ const attrsProxyHandlers = __DEV__
11041098 * Dev-only
11051099 */
11061100function 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+ } )
11161107}
11171108
11181109export function createSetupContext (
@@ -1146,6 +1137,7 @@ export function createSetupContext(
11461137 // We use getters in dev in case libs like test-utils overwrite instance
11471138 // properties (overwrites should not be done in prod)
11481139 let attrsProxy : Data
1140+ let slotsProxy : Slots
11491141 return Object . freeze ( {
11501142 get attrs ( ) {
11511143 return (
@@ -1154,7 +1146,7 @@ export function createSetupContext(
11541146 )
11551147 } ,
11561148 get slots ( ) {
1157- return getSlotsProxy ( instance )
1149+ return slotsProxy || ( slotsProxy = getSlotsProxy ( instance ) )
11581150 } ,
11591151 get emit ( ) {
11601152 return ( event : string , ...args : any [ ] ) => instance . emit ( event , ...args )
0 commit comments