@@ -179,11 +179,6 @@ export const ComponentEnclosure = observer(
179
179
return ;
180
180
}
181
181
182
- if ( this . updateComponentTimeout ) {
183
- clearTimeout ( this . updateComponentTimeout ) ;
184
- this . updateComponentTimeout = undefined ;
185
- }
186
-
187
182
if ( this . elRef . current && this . listIndex == 0 ) {
188
183
const component = this . props . component ;
189
184
if ( component instanceof ProjectEditor . PageClass ) {
@@ -198,7 +193,6 @@ export const ComponentEnclosure = observer(
198
193
199
194
if ( this . elRef . current . offsetParent == null ) {
200
195
// do not calculate geometry if element is not visible
201
-
202
196
this . updateComponentTimeout = setTimeout ( ( ) => {
203
197
this . updateComponentTimeout = undefined ;
204
198
this . updateComponentGeometry ( ) ;
@@ -221,12 +215,24 @@ export const ComponentEnclosure = observer(
221
215
}
222
216
} ;
223
217
218
+ debounceUpdateComponentGeometry = ( ) => {
219
+ if ( this . updateComponentTimeout ) {
220
+ clearTimeout ( this . updateComponentTimeout ) ;
221
+ this . updateComponentTimeout = undefined ;
222
+ }
223
+
224
+ this . updateComponentTimeout = setTimeout ( ( ) => {
225
+ this . updateComponentTimeout = undefined ;
226
+ this . updateComponentGeometry ( ) ;
227
+ } ) ;
228
+ } ;
229
+
224
230
componentDidMount ( ) {
225
- this . updateComponentGeometry ( ) ;
231
+ this . debounceUpdateComponentGeometry ( ) ;
226
232
}
227
233
228
234
componentDidUpdate ( ) {
229
- this . updateComponentGeometry ( ) ;
235
+ this . debounceUpdateComponentGeometry ( ) ;
230
236
}
231
237
232
238
componentWillUnmount ( ) {
0 commit comments